Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set dynamic width & height of a view in autolayout in iOS?

I have a UIView in my super view.I have set it some constraints.Now I want the size of view should be different on different devices.If I set the fix width & height then I get the wrong result.I have tried to user aspect ratio but that make a view too big or too small on multiple devices.

I want the height & width should increase in equal proportion that it must look same all devices.I want to have flexible height and width of the view.Please tell how to do this?

Here is the image enter image description here

Thanks in Advance

like image 437
TechChain Avatar asked Jun 11 '15 09:06

TechChain


1 Answers

Use Size Classes. It helps to have different settings for different devices. http://www.raywenderlich.com/83276/beginning-adaptive-layout-tutorial https://youtu.be/IwSTXY0awng?t=2m12s

like image 162
iamandrewluca Avatar answered Sep 20 '22 18:09

iamandrewluca