iOS 6 supportedInterfaceOrientations issue

后端 未结 5 1117
傲寒
傲寒 2021-01-17 06:10

In my view controller, I implement two methods for controlling interface orientation:

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOr         


        
5条回答
  •  醉酒成梦
    2021-01-17 06:42

    Two points:

    1. Your error message makes complete sense because it makes no sense to use UIInterfaceOrientationPortrait as a return value from supportedInterfaceOrientations, which is returning a bit mask. Use one of the UIInterfaceOrientationMask values.

    2. You seem to be concerned that if you use the proper UIInterfaceOrientationMaskPortrait, that iOS doesn't appear to call shouldAutorotate. It may only call shouldAutorotate if, having considered the physical device's physical orientation and the app's current orientation against the supportedInterfaceOrientations that a rotation might be needed. Why should it check shouldAutorotate if it concludes that the device is in an acceptable orientation already?

    See supportedInterfaceOrientations and Handling View Rotations for more information.

提交回复
热议问题