iOS 8: Landscape UIViewController not being displayed correctly in new UIWindow
| Originator: | feedback.tagher | ||
| Number: | rdar://18150985 | Date Originated: | Aug 27, 2014 |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | Xcode6-Beta6 (8.0 simulator) |
| Classification: | Serious Bug | Reproducible: | Always |
Example project:
https://www.dropbox.com/s/2rswzao0k7s1zm0/WindowNotSizing.zip?dl=0
Summary:
When a landscape only UIViewController is created and set as the root view controller of a UIWindow, the view controller is incorrectly displayed/sized (as if it was in portrait). This does not occur in iOS 7.
https://www.dropbox.com/s/08p6s9aep9fx39g/Screenshot%202014-08-27%2011.23.54.png?dl=0
Our specific use case for this is the Heyzap Advertising SDK. When displaying a fullscreen video ad, we create a new window and set a landscape only UIViewController as its rootViewController, then call `makeKeyAndVisible` on the window to display the ad.
Several people are experiencing the same problem, though they're not second window at runtime, but rather having this problem with a landscape only root view controller:
https://devforums.apple.com/thread/240069?tstart=15
One dev from there says he filed a bug #17960800 about this.
Steps to Reproduce:
(See the attached sample project zip file; it already has this implemented with helpful NSLog statements)
1. Create a new Xcode project (I used Xcode6-Beta6)
2. Create a LandscapeOnlyViewController class with these methods implemented:
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor greenColor];
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscapeRight;
}
3. In the App Delegate, create a new window after the app launches, making sure to hold a strong reference to it:
@property (nonatomic, strong) UIWindow *secondWindow;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
self.secondWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
LandscapeOnlyViewController *vc = [[LandscapeOnlyViewController alloc] init];
self.secondWindow.rootViewController = vc;
[self.secondWindow makeKeyAndVisible];
});
4. Run the app
Expected Results:
The LandscapeOnlyViewController's view covers the screen in a landscape orientation.
Actual Results:
The view looks to still be in portrait, despite the device being in landscape
https://www.dropbox.com/s/08p6s9aep9fx39g/Screenshot%202014-08-27%2011.23.54.png?dl=0
iOS 7 vs iOS 8 logs
2014-08-27 11:11:17.466 WindowNotSizing[43242:70b] iOS Version = 7.0.3
2014-08-27 11:11:17.467 WindowNotSizing[43242:70b] View bounds = {{0, 0}, {568, 320}}
2014-08-27 11:11:17.468 WindowNotSizing[43242:70b] View frame = {{0, 0}, {320, 568}}
2014-08-27 11:11:17.468 WindowNotSizing[43242:70b] View transform = [0, 1, -1, 0, 0, 0]
2014-08-27 11:11:17.468 WindowNotSizing[43242:70b] Window bounds = {{0, 0}, {320, 568}}
2014-08-27 11:11:17.469 WindowNotSizing[43242:70b] Window frame = {{0, 0}, {320, 568}}
2014-08-27 11:11:17.469 WindowNotSizing[43242:70b] Window transform = [1, 0, 0, 1, 0, 0]
2014-08-27 11:11:17.469 WindowNotSizing[43242:70b] Screen bounds = {{0, 0}, {320, 568}}
2014-08-27 11:10:42.611 WindowNotSizing[43168:325209] iOS Version = 8.0
2014-08-27 11:10:42.612 WindowNotSizing[43168:325209] View bounds = {{0, 0}, {320, 568}}
2014-08-27 11:10:42.612 WindowNotSizing[43168:325209] View frame = {{0, 0}, {320, 568}}
2014-08-27 11:10:42.612 WindowNotSizing[43168:325209] View transform = [1, 0, 0, 1, 0, 0]
2014-08-27 11:10:42.612 WindowNotSizing[43168:325209] Window bounds = {{0, 0}, {320, 568}}
2014-08-27 11:10:42.612 WindowNotSizing[43168:325209] Window frame = {{0, 0}, {320, 568}}
2014-08-27 11:10:42.612 WindowNotSizing[43168:325209] Window transform = [1, 0, 0, 1, 0, 0]
2014-08-27 11:10:42.613 WindowNotSizing[43168:325209] Screen bounds = {{0, 0}, {568, 320}}
Version:
iOS Simulator Version 8.0 (550) // Xcode Version 6.0 (6A280e)
Notes:
Configuration:
iOS Simulator
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!