Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autolayout constraints not working iPhone 6 and 6 Plus

My app displays the views properly on iPhone 5, but on 6 and 6 Plus, the views do not fill the screen horizontally. I tried adding autoconstraints through Storyboard, but they do not make a difference.

Below are what I have in Storyboard for the blue view (and subviews), and a screenshot of the app for the Plus.

enter image description here

enter image description here

like image 918
Mahir Avatar asked Jan 22 '15 11:01

Mahir


People also ask

What is iOS Autolayout?

Auto Layout is a constraint-based layout system. It allows developers to create an adaptive interface that responds appropriately to changes in screen size and device orientation.

What is aspect ratio constraint iOS?

Aspect ratio constraint is used to control the width and height of a view as per a aspect ratio that you set here. There are some standard presets such as 1:1 which means width will be equal to height. Similarly other presets calculates the dimensions based on a ratio.


1 Answers

I have already encounter this problem. It is because of margins. You just have to uncheck Constraint to margin in Interface Builder.

enter image description here

And you should also check directly on the constraint (Click on it). enter image description here

like image 101
LastMove Avatar answered Oct 05 '22 23:10

LastMove