Lock UIViewController orientation on iOS 8

My application uses a view controller, which should be locked in landscape mode. It works fine in iOS 6 and 7, but not in iOS 8. I was wondering if anyone had heard or read anything about this that no longer works in iOS 8.

My code calls - (NSUInteger)supportedInterfaceOrientationsjust fine, but ignores the return value and does not go from portrait to landscape.

My code is:

- (BOOL)shouldAutorotate {
    return YES;
}

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskLandscape;
}
+4
source share

Source: https://habr.com/ru/post/1547764/


All Articles