Vijay Sharma Vijay Sharma - 29 days ago 6
iOS Question

UIWebBroswerView has gap from top of UIWebView

I have a

UIWebView
which is taking up a whole view in my ViewController, which you can see here:

WebView

What I don't understand, is when I run my app, the contents of my
UIWebView
does not fill up the whole screen, you can see this here, where I first show the extent of the
UIWebView
(it is indeed taking up the whole screen):

WebView

And then here, where I show the extend of the
UIWebBrowserView
(which seems to have a gap from the top of the
UIWebView
).

WebView

Does anyone know why the
UIWebBrowserView
has a gap from the top of the
UIWebView
?

Answer

I think this happens because of UIViewController's ScrollView Inset Property. Default value for adjustScrollViewInset is True.

Select ViewController and go to Attribute Inspector Tab. Uncheck Adjust Scroll View Insets option.

enter image description here