Limpuls
Limpuls

Reputation: 876

Auto-layout constraints to make WKWebView go full screen

I will mention right away that I'm not iOS developer and this is first time I'm messing with it because I was asked to update web application inside iOS WKWebView wrapper.

I managed to load the web app inside iOS app but on iPhone X there is always white space on top and bottom. I just learned about constraints and I heard that this is default safe area behaviour. I'm trying to expand my WKWebView past safe area to go all the way to the top notch and bottom home button so that there are no white spaces. Inside Xcode all constraints for safe area object is set equal to superview, following web view container object set equal to superview. But I still have white spaces on top and bottom.

There is also top "View" object which I think is elsewhere known as superview, which when I click on I see the constraints for it set equal to safe area and I can only keep it set to safe area or web view container which itself is set to superview. I find this very confusing. What am I doing wrong here?

I would appreciate help regarding storyboard and not code related as I don't speak Swift.

EDIT: Snapshots of constraints

Web View Container Object: https://i.sstatic.net/wQP15.jpg

Upvotes: 0

Views: 1010

Answers (1)

leorider
leorider

Reputation: 184

If you use storyboard, you can do like this:

  1. select this constraint and at the right panel, you should change the Second item form Safe Area to SuperView like below:

enter image description here

enter image description here

  1. modify the Constant value from 44 to 0, like below:

enter image description here

  1. the same operation to other constraints.

Upvotes: 0

Related Questions