Suppose there are two labels in my UITableViewCell. In a portrait orientation, the second label is under the first one, in a Landscape orientation the two labels are on the same line.
First I noticed that in interface builder, if the layout of all the elements are Autoresizing Mask (and not inferred) I'm unable to put a constraint on width and heigth of the UITableViewCell and it's contentView.
Now I choose in IB: orientation Portrait, I click on Vary For Traits and I put the necessary constraints. After that, I do the same for orientation Landscape.
Then, whatever the orientation is in IB, I only see my last choice (landscape). IB doesnt react to Portrait or landscape orientation.
And it is the same when I run the App: I only see the landscape layout.
Where is my mistake? Do I have to make differnt nib files for all devices variations?
But for what you want (adapt to device), the best may be:
create IBOutlets for the constraints
in viewWillLayoutSubviews(), adapt the value of the constraints