Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Workaround for rdar://19592583 (see https://gist.github.com/steipete/8df39fea0d39680a7a6b)
@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
@joelparsons

This comment has been minimized.

Copy link

@joelparsons joelparsons commented Jan 26, 2015

this is so messed up. Thanks though Peter, You've saved me hours again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment