Supporting both iOS 6 and iOS 5 autorotation

后端 未结 6 1377
-上瘾入骨i
-上瘾入骨i 2020-12-06 05:46

Can anyone confirm that to support both iOS 6 and iOS 5 there is no point to adding the new iOS 6 autorotation methods, since the Apple docs suggest that these methods are c

6条回答
  •  执笔经年
    2020-12-06 06:16

    I think the most elegant solution is:

    - (NSUInteger)supportedInterfaceOrientations {
        return UIInterfaceOrientationMaskPortrait;
    }
    
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
        return ((1 << toInterfaceOrientation) & self.supportedInterfaceOrientations) != 0;
    }
    

    Do I miss something?

提交回复
热议问题