Skip to content

Instantly share code, notes, and snippets.

@steipete
Created November 7, 2014 18:11
Show Gist options
  • Save steipete/d7ee1219cbb2dd67cedc to your computer and use it in GitHub Desktop.
Save steipete/d7ee1219cbb2dd67cedc to your computer and use it in GitHub Desktop.
Workaround for rdar://18906964: Moving UIViewController from one window to another breaks rotation in iOS 8.1
@interface FullscreenWindow : UIWindow @end
@implementation FullscreenWindow
- (void)setRootViewController:(UIViewController *)rootVC {
// Try to clear the existing interface orientation, fixes rdar://18906964.
// Apparantly in iOS 8.1 the interface orientation doesn't correctly clears out,
// which then leads to weird rotation issues.
@try {[rootVC setValue:@(UIInterfaceOrientationPortrait) forKey:NSStringFromSelector(@selector(interfaceOrientation))];}
@catch (NSException *exception) {}
[super setRootViewController:rootVC];
}
- (void)setFrame:(CGRect)frame {
[super setFrame:UIScreen.mainScreen.bounds];
}
@end
@steipete
Copy link
Author

steipete commented Nov 7, 2014

Also see http://openradar.appspot.com/radar?id=5878593745846272

If you find it useful, leave a comment here. No need for an attribution license, just a small thanks will make my day.

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