willRotateToInterfaceOrientation:duration: not called for iOS5 after dismissing from modal
- by Jean-Denis Muys
My main UIViewController overrides willRotateToInterfaceOrientation:duration: to adapt the background view for the correct orientation. This works fine when staying within the view.
But in my app, the result of some user actions can lead to presenting another "daughter" UIViewController. When the user is done with that daughter UIViewController, she normally returns to the main view controller. My code calls dismissModalViewControllerAnimated: to do so.
The issue occurs when the user changes the iPad orientation while the daughter UIViewController is on screen. Then, the main UIViewController will never see any call to willRotateToInterfaceOrientation:duration: and its background view will be incorrect.
This setup works fine in iOS 4: the iOS 4 implementation of dismissModalViewControllerAnimated: calls UIWindow's _setRotatableClient:toOrientation:updateStatusBar:duration:force: which calls willRotateToInterfaceOrientation:duration: for the switched in UIViewController.
Apparently , this behavior changed for iOS 5.
How am I expected to implemented orientation changes while my view is off screen under iOS5? Am I supposed to query the current orientation in viewWillAppear: for example?