alexander alexander - 9 months ago 86
iOS Question

Uiview size issue Xcode

I'm new in storyboard and , for exercise , I created a .xib file when I put a

and a background color , but when I execute it on iPhone 7 plus simulator I get this issue(the view doesn't fill the whole screen like in the xib file , both height and width) , while if I execute it on iPhone 6(not plus) simulator the view is correct like .xib file

enter image description here

How do I solve this issue?

Zhr Zhr
Answer Source

You need to add auto-layout constraints by control-dragging from your view(in your case pink colored view) to superview and select (equal width, equal height). Should look something like this. Of course, you have to handle other constraints too but it seems it will only confuse you. I'd advise you to go through some auto-layout tutorials. Hope that helps.

enter image description here