Created
November 7, 2014 18:11
-
-
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
This file contains hidden or 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 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.