iPhone Orientation Relayout From Single Column to Double Column

Posted by kkrizka on Stack Overflow See other posts from Stack Overflow or by kkrizka
Published on 2010-04-04T02:33:24Z Indexed on 2010/04/04 2:43 UTC
Read the original article Hit count: 472

I am trying to create a UIView in Interface Builder that shows to the user two boxes containing some text. This UIView should support both landscape and portrait modes.

When in portrait orientation, the two boxes should be centered horizontally and be under each other. Like in the picture below: Portrait Mode

But when in landscape orientation, it should show the two boxes centered vertically and by side by side. Like in the picture below: Landscape Mode

Is this possible using only the autosizing options (or any other IB options), or do I have to relayout the view in code on orientation change events? I would prefer using only IB.

I tried locking the top and left margins of the top box and locking the bottom and right margins of the bottom box. But the problem is that for it to work I also need to shrink the two boxes as one changes from portrait to landscape, because otherwise they would overlap.

© Stack Overflow or respective owner

Related posts about interface-builder

Related posts about interface-orientation