Search code examples
iphoneipadiostabbarautosize

Tab views on iPad not resizing


My view doesn't stretch to fit the current orientation!

I am creating a tab bar application. I replicated the sample one that you create when you "create a new tab bar application". Everything works except when I change the orientation of the iPad it rotates the view, the tab bar stretches out on the bottom, but the view doesn't resize. Basically if you start in landscape then rotate to portrait, it rotates but the view is still landscape shape even though it rotates.

My tab bar has two tabs (just like the sample application) and so I compared mine against the sample which works property by property. One difference is I noticed my FirstView in IB under the resizing area doesn't show the resize arrows left/right up/down. In other words it isn't marked to auto fill its container. The sample's FirstView and SecondView DO have these arrows. But I can't turn them on!

I even tried creating a fresh new view but I still can't press these arrows on. what am I doing wrong here?'

Thanks a lot.


Solution

  • The solution is this:

    self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

    Do this in viewDidLoad. There must be a bug in IB.