Set different supportedInterfaceOrientations for different UIViewControllers

后端 未结 2 1914
傲寒
傲寒 2020-12-20 01:35

So, as by the question, I use the following code to set userinterfaceOrientation for the viewcontroller.

- (BOOL) shouldAutorotate
{
    return YES;
}

-(NS         


        
相关标签:
2条回答
  • 2020-12-20 02:09

    I'd say implement your shouldAutorotateToInterfaceOrientation: on every view controller to make it return only YES for those orientations you wish to support.

    0 讨论(0)
  • 2020-12-20 02:17

    I was able to accomplish this by placing my supported orientation logic in a custom UINavigationController. I then segue to the relevant view controller.

    @implementation PortraitNavigationController
    
    - (NSUInteger)supportedInterfaceOrientations{
        return UIInterfaceOrientationMaskPortrait;
    }
    

    ...

    0 讨论(0)
提交回复
热议问题