View controllers inside tab bar controller not auto

( Correction : the view controllers are not auto-resizing instead of not auto-rotating.)

In an iPad app, I have five regular view controllers (not navigation controllers or anything like that) inside a tab bar controller. The tab bar controller is just a plain UITabBarController declared in the app delegate.

All the view controllers return YES in the shouldAutorotateToInterfaceOrientation method.

On both the simulator and device, on rotation, the tab bar and the current view controller rotate but the currently selected view controller (call it A) does not resize properly. It keeps its portrait width and height (but it is rotated).

If I switch to another view controller B and then back to A (without rotating the device again), A appears correctly resized.

This happens with any of the five view controllers

Why doesn't the currently selected view controller resize immediately on rotation and how do I fix it?

Thanks.


You should add :

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

To each viewDidLoad method of the sub-viewcontrollers of your tabbar controller.

链接地址: http://www.djcxy.com/p/54958.html

上一篇: TabBar支持Three20 iPhone照片库

下一篇: 标签栏控制器内的视图控制器不是自动的