93sauu
93sauu

Reputation: 4097

How to force view controller orientation in iOS 10?

I have tried:

--> Subclassing UINavigationController and overriding autorotate methods

--> Overriding autorotate methods on MyViewController

--> And both.

Note: Also, I tried with autorotate sets NO and YES

This is my code:

NavigationControllerNoAutorotate:

@implementation NavigationControllerNoAutorotate

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
    return UIInterfaceOrientationPortrait;
}

- (BOOL)shouldAutorotate {
    return YES;
}

@end

MyViewController:

- (BOOL)shouldAutorotate {
    return NO;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait;
}


- (UIInterfaceOrientationMask)navigationControllerSupportedInterfaceOrientations:(UINavigationController *)navigationController {
    return UIInterfaceOrientationPortrait;
}

Upvotes: 1

Views: 2528

Answers (1)

93sauu
93sauu

Reputation: 4097

The problem was that I was testing on iPad, and I activated the SplitView on deployment info. When "Requires Full Screen" is YES, split view is deactivated.

I found the solution on this LINK

Upvotes: 1

Related Questions