0

I am trying to make WKWebView full screen in iOS. I found an answer in Swift, make WKWebview "real" fullscreen on iPhone X (remove safe area from WKWebView

Unfortunately, I need to use Objective-C this time.

Please help to convert the Swift code below to Objective-C

class FullScreenWKWebView: WKWebView {
    override var safeAreaInsets: UIEdgeInsets {
        return UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
    }
}

Or if there is any other better ways to do it in Objective-C.

Thanks.

zyc
  • 41
  • 1
  • 5

1 Answers1

1

Here's the Objective-C translation for the code in your question:

#import <WebKit/WebKit.h>

@interface FullScreenWKWebView : WKWebView
@end

@implementation FullScreenWKWebView

- (UIEdgeInsets)safeAreaInsets {
    return UIEdgeInsetsMake(0.0f, 0.0f, 0.0f, 0.0f);
}

@end
Pranay
  • 846
  • 6
  • 10