Created
January 25, 2015 20:28
-
-
Save steipete/d928debb92e86de89eb2 to your computer and use it in GitHub Desktop.
Workaround for rdar://19592583 (see https://gist.github.com/steipete/8df39fea0d39680a7a6b)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface PSPDFWindow () | |
@property (nonatomic, strong) UIViewController *realRootViewController; | |
@end | |
@implementation PSPDFWindow | |
- (void)setHidden:(BOOL)hidden { | |
[super setHidden:hidden]; | |
// Workaround for rdar://19592583 | |
// Adding a second UIWindow breaks rotation logic in iOS 8 | |
// If we remove the root view controller, we disallow rotation which solves the iOS 8 regression. | |
if (hidden) { | |
self.realRootViewController = self.rootViewController; | |
[super setRootViewController:nil]; | |
} else { | |
if (self.realRootViewController) { | |
[super setRootViewController:self.realRootViewController]; | |
self.realRootViewController = nil; | |
} | |
} | |
} | |
- (void)setRootViewController:(UIViewController *)rootViewController { | |
[super setRootViewController:rootViewController]; | |
self.realRootViewController = nil; | |
} | |
@end |
8 years later, still helpful. Thank you!
Stumbled upon this bug, and this helps even after 10 years, thanks for sharing this :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this is so messed up. Thanks though Peter, You've saved me hours again.