View controllers inside a tab bar controller instead of auto-resizing on rotation

( Correction : View controllers do not automatically resize, not automatically rotate.)

In an iPad app, I have five regex controllers (not navigation controllers or something) inside a tab bar controller. A tab bar controller is a simple UITabBarController declared in an application delegate.

All view controllers return YES in the shouldAutorotateToInterfaceOrientation method.

On both the simulator and the device, when rotated, the tab bar and current view controller rotate, but the currently selected view controller (call A) does not resize. It maintains the width and height of its portrait (but it rotates).

If I switch to another view controller B and then back to A (without re-rotating the device), A is changed correctly.

This happens with any of the five view controllers

Why does the currently selected view controller not change when rotated and how to fix it?

Thanks.

+2


a source to share


1 answer


You must add:

self.view.autoresizesSubviews = YES;
self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

      



For each viewDidLoad method for subtask controllers of your tablet controller.

+7


a source







All Articles