Reputation: 237
This is the first time I'm making an iOS app in both orientations.
I have a UIView placed like in above image.
I have set the following constraints: Horizontally Centered, Vertically Centered, Leading and Trailing Space : 8, Height : 265.
I want this UIView to look fullscreen in landscape mode such that Leading, Trailing, Top and Bottom is stuck to all edges.
Please help me in doing it. The above set constraints are not looking proper in landscape. See image below :
The above screenshots are of iPhone 6s size. I need app to support iPad in both orientations too.
These are the constraints already applied by me :
EDIT : After vary for traits is applied :
Portrait constraints are the active one and greyed out ones are applied to landscape. It looks as I want in storyboard but still taking height of portrait during runtime.
EDIT 2: Vary for traits is working on that particular size class but not on all size classes. Please suggest how to set same constraints on all size classes.
Upvotes: 2
Views: 2730
Reputation: 1340
select landscape option (below the screen near to setting auto layout pane) then press vary for traits , now give new constraints that you want in landscape mode then select done varying.
Now you have two different constraints for landscape and portrait mode.
Upvotes: 10
Reputation: 856
Add below constraints just change the value of constant according to your requirement -
Check below -
Upvotes: 2