Multiple UIWindows with UIViewControllers cannot be autorotated the same
| Originator: | phil.larson | ||
| Number: | rdar://7363362 | Date Originated: | 11/3/09 |
| Status: | Open | Resolved: | |
| Product: | iPhone SDK | Product Version: | 3.0 |
| Classification: | Other Bug | Reproducible: | Always |
Summary: If you use multiple UIWindows in an application that each use a UIViewController subclass as their root view, then the first window will autorotate for supported orientations, but the second window cannot use those same orientations. Steps to Reproduce: 1. Create a window 2. Add a UIViewController subclass, such as UINavigationController, with the ability to autorotate to Portrait, the default behavior. 3. Create a second window. 4. Add a UIViewController subclass, such as UITabBarController, with the ability to autorotate to Portrait and LandscapeLeft. 5. The second window will be able to rotate to LandscapeLeft but unable to get back to portrait. 6. If you instead change the first window's view controller to always return NO for shouldAutorotate, then the second window can autorotate normally. Expected Results: Both windows to autorotate properly. Actual Results: The second window is only able to auto rotate to LandscapeLeft and cannot auto rotate to Portrait Regression: Unknown Notes: I've attached a sample project. If you take out the comment in TestViewController.m line 46 then you will see the second window is unable to rotate back to portrait mode. From tracing through UIKit, it seems like the second window doesn't get the device orientation notification until after the interface orientation has changed, so it doesn't attempt to rotate itself.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!