DAN
DAN

Reputation: 939

iOS - Autolayout from Landscape to Portrait

I've designed a xib for iPhone in Landscape mode which has a fullscreen view containing many subviews.

Is it possible to automatically adapt it to Portrait as sketched here: http://img850.imageshack.us/img850/5523/5cxw.jpg without having to create tons of contraints for each subview?

Upvotes: 0

Views: 227

Answers (1)

Arek Holko
Arek Holko

Reputation: 9006

Enclose all the subviews in the new UIView. Set leading, trailing, top and bottom constraints between the new view and the main view. Then in willRotateToInterfaceOrientation:duration: set correct constant's of these constraints. In landscape they should all be equal to 0. In portrait set them accordingly to get the look you're looking for.

Upvotes: 1

Related Questions