iPhone Orientation Relayout From Single Column to Double Column
- by kkrizka
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:
But when in landscape orientation, it should show the two boxes centered vertically and by side by side. Like in the picture below:
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.