iOS 7 – Restrict landscape orientation only in one view controller

Fixed it simply by creating UINavigationController class and overriding

-(NSUInteger)supportedInterfaceOrientations
{
    AppDelegate *appDelegate = (AppDelegate *) [UIApplication sharedApplication].delegate;
    if(appDelegate.isOrientationOn) {
        return UIInterfaceOrientationMaskAll;
    }
    return UIInterfaceOrientationMaskPortrait;
}

Use this custom navigation controller class in root window and that’s all.

Leave a Comment