shouldAutorotateToInterfaceOrientation: never called

前端 未结 2 637
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-22 08:51

I set supported Interface Orientations to be all except Portrait upside down under Deployment Info.

I would like to override shouldAutorotateToInterfaceOrientation: for

相关标签:
2条回答
  • 2021-01-22 08:55

    was using ios6

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
    

    is deprecated on ios6

    0 讨论(0)
  • 2021-01-22 09:13

    Its Working for me:

    - (BOOL)shouldAutorotate {
        return YES;
    }
    
    - (NSUInteger)supportedInterfaceOrientations {
        NSUInteger orientations = UIInterfaceOrientationMaskPortrait;
        if ([self isKindOfClass:[YourViewController class]]) { // Your view class
            orientations |= UIInterfaceOrientationMaskPortraitUpsideDown;
        }
        return orientations;
    }
    

    orientations:

    orientations |= UIInterfaceOrientationMaskLandscapeLeft;
    orientations |= UIInterfaceOrientationMaskLandscapeRight;
    
    0 讨论(0)
提交回复
热议问题