Forum Xamarin.Forms

iOS SafeArea + WKWebview

sadddsadsasadddsadsa USMember ✭✭
edited June 2019 in Xamarin.Forms


I have a WKWebview in a window without SafeArea because I want the content to be seen until the end of the screen.

To do this, I have created a CustomWebview by overriding the safeAreaInserts:

        public class CustomWKWebView : WKWebView {

        static UIEdgeInsets _safeAreaInserts = new UIEdgeInsets(0, 0, 0, 0);

        public CustomWKWebView(IntPtr handle) : base(handle) { }
        public CustomWKWebView(NSCoder coder) : base(coder) { }
        public CustomWKWebView(NSObjectFlag t) : base(t) { }
        public CustomWKWebView(CGRect frame, WKWebViewConfiguration configuration) : base(frame, configuration) { }

        public override UIEdgeInsets SafeAreaInsets => _safeAreaInserts;


Yes, it works but ..

. I need something more: The device notch hides webview content.

I ned that side of webview that is under the notch keeps the "Margin" so that the content is not below the notch.

That is to say: I want webview cover the entire screen except under the notch.

Some ideas?


Sign In or Register to comment.