Ok I've finally taken the plunge into autolayout using Xcode 8.
I might conceptually have the wrong idea. However I have a view in IB which has 2 labels a button and an imageview dead center in the view with dimensions 300 x 300 for 6plus and 6 devices.
What I want to do is vary the imageview size for iPhone 5 (SE) so I click Vary for Traits and select height and width then change the values to 150 x 150 click done and the all looks good looking at iphone 5 (SE).
Now flicking back to 6plus and 6 its also resized to 150 x 150 but I want the image size to remain as 300 x 300. Again I may have the wrong idea completely.
I thought the whole point in this is that its varying the size dependant on what is selected i.e. varied.
Vary for traits or size class is not used to change autolayout for different devices, rather it is used to change layouts for Regular and Compact size of (width or height or both).Too many devices come under regular width like ipad pro iphone 7 plus, etc. same iphone se and iphone6 in portrait mode has same width thats is Compact. So when you change for one it changes for both. When you choose vary for traits and select width+height checkbox it shows some devices in blue box it means all those will be effected.
Better do it programmatically, check device type and set size according to it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With