Orientation changes when all my view controllers are rotated?

If I have several UIViewControllers pushed onto my navigation stack, how / when are the invisible (lower) view controllers re-displayed? Are they all laid out simultaneously with the visible view controller or only after they are unloaded in the display stack?

edit I am currently managing resizing of a subview (instead of setting autoresizing = YES). I am doing a resize in the willAnimateRotationToInterfaceOrientation method so that it is well animated. I assume that this method is not called for any uiviewcontroller, and not on top of the display stack. So, there is a built-in way to find out if the current uiviewcontroller is the one that is displayed, and if not, which method should I override to relay my routines to uiviewcontrollers that are not at the top of the display stack

Thanks!

Solar

+4
source share
1 answer

I would suggest checking orientation in viewWillAppear . If you check the orientation here, you can be sure that the view will always be displayed in the correct location for the given orientation. You still need to rotate it to willAnimateRotationToInterfaceOrientation .

 -(void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; if (UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation)) { [self layoutForPortrait]; } else if (UIDeviceOrientationIsPortrait([UIDevice currentDevice].orientation)) { [self layoutForLandscape]; } } 
0
source

All Articles