"Vary for Traits" not working as expected

ios, iphone, xcode8

Solution

Perhaps by now you have figured it out. But in case others have a similar problem, here's my 2 cents:

I was facing a like problem: a label needed to have a different height for iPhones and iPads. But every time I changed the height of the label on the iPad using vary for traits, it also changed the height on the iPhone.

Here's what I did to fix it:

- Select the object (in my case, a label)

- In the Size Inspector, double click the constraint you want to change for a different device

- Click on the + sign next to Constant.

- Select the appropriate traits (in my case, regular height+width for iPad) and add the variation.

- Now, underneath the Constant dropdown menu, you will now see your different layout for the corresponding device.

- You can now change the size of the respective constraint.

Please note that you have to do this for each constraint you need to change. I realise that it should also work by selecting the desired device and click Vary for Traits. But I think it's buggy and so this is an alternative way of accomplishing the same thing.

Problem

From what I understand as explained in the answer to this question you can resize which ever component on the storyboard for any device that you want, well that right there is the where the problem occurs.. I have an image which the regular resolution of it is : 353x229 and this image looks huge on the iPhone 4s screen so I want to resize it to 300x194 only on the 4s screen and this is how I do it : First I click on the Vary for Traits button, then I click on the image and then click on the "Show the Size inspector" on the right side and from there I change the "Width Equals" to 300 and "Height Equals" to 194 and then I click on "Done Varying". But the problem is the image is resized for every single device ! Even the iPad ! I don't understand why this is happening and how am I supposed to stop this from happening?

Original source

Related problems