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

冷暖自知 提交于 2019-12-04 00:49:49

Hai I have found solution for my problem

Solution: For the app which consist UINavigation controller, just I created a category for UINavigation Controller class and I defined these methods

-(BOOL) shouldAutorotate{
    return YES;
}

-(NSUInteger) supportedInterfaceOrientations{

    return UIInterfaceOrientationMaskAll;
}

After adding this, all orientation were supported in my app.

The same, I done for UITabBar Controller also.This too worked for me by creating category for UITabBar Controller.

Thank you.

Phone apps traditionally don't support upside down (why would you hold the phone upside down?) - the default project will support portrait and both landscape options, but not upside down.

Change this in the project info viewer in Xcode and you should be fine. There is a visual representation of the supported orientations, and upside down will be unselected.

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;
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!