当前位置: 动力学知识库 > 问答 > 编程问答 >

iphone force portrait mode from landscape?

问题描述:

I have a complicated structure where I have a custom tab-bar controller that houses multiple navigation controllers. Some of these sub-navigation controllers only support portrait mode so I just turn off rotation when I get to them. When I come into the new navigation controller and it is in landscape is there a way to force auto-rotation to portrait at that time?

网友答案:

Apple is no longer allowing private method calls, they're running the apps through static analysis now when they're submitted. If you submit a new app using [[UIDevice currentDevice] setOrientation:] it will be rejected.

网友答案:

You can try the undocumented method setOrientation: from the UIDevice class. Here is one example:

[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationPortrait];

You will have one compiler warning, ignore it.

I do not have problem with Apple rejection using this method, so until now it works.

分享给朋友:
您可能感兴趣的文章:
随机阅读: