Upside down orientation not working in iOS6 for UINavigation view and UITabbar view?

后端 未结 3 929
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-19 01:44

I created an app in ios 6 with navigation view.Also I have set all orientation options in the application summary and even used the

 -(BOOL) shouldAutoRotate
         


        
3条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-19 02:11

    I think the solution of NSUserDefault is incomplete:

    From: https://developer.apple.com/library/ios/qa/qa1688/_index.html

    Note: You should always prefer subclassing to categories when modifying rotation behavior for UIKit classes such as UINavigationController. Because other classes may depend on the existing behavior of the UIKit container view controllers, the changes introduced by a category may cause unexpected behavior.

    So I think the best solution is to create a subclass and to add:

    -(BOOL) shouldAutorotate{
         return YES;
    }
    
    -(NSUInteger) supportedInterfaceOrientations{
    
         return UIInterfaceOrientationMaskAll;
    }
    

提交回复
热议问题