What constraints I should add to set width and height proportional to the Superview (in my case its the UIViewController's view) in iOS Autolayout, with Autoresizing we can do like the pic shown below.
Asked
Active
Viewed 2,295 times
3
-
Are you talking about aspect fit, [and is this a duplicate question](http://stackoverflow.com/questions/25766747/emulating-aspect-fit-behaviour-using-autolayout-constraints-in-xcode-6)? – Michael Dautermann Dec 02 '14 at 10:53
1 Answers
4
if a uiview in a uiviewcontroller.
you must add centre horizontally and vertically in container constraint for that uiview.
you need to add equal height and equal width constraint for that uiview with your super view.
- select both equal height constraint and equal width constraint and add multiplier to that constraint as your needs.

Thanveer Ahammed
- 148
- 9
-
1Question is, how to calculate multiplier. E.g on 480(iphone 4) i want view height to be 40 in iPhone 5s , thats 18.33% increase so i will set multiplier to increase 40 + 40*18.33% , however the increase in iPhone 6/6plus is different. So how can i set one multiplier for all – Muhammad Umar Jul 24 '16 at 06:05