在我的应用程序中,我得到了2个UIViewControllers,第一个是UINavigationController中的根控制器,第二个是由第一个通过推送到UINavigationController's堆栈调用的。
所以第一个视图应该只支持纵向方向,而第二个视图应该支持所有方向。
我首先写了这段代码:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{
return toInterfaceOrientation == UIInterfaceOrientationPortrait;
}但它仍然向所有方向旋转。为什么?
发布于 2013-04-23 20:49:50
我没有使用uinavigationcontroller,而是使用了presentmodalviewcontroller。这让我可以使用不同的方向管理。
发布于 2013-04-23 17:40:58
请问您使用的IOS版本是什么?此方法在IOS 6中已弃用
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation请查看以下URL投票结果可能是您想要的答案
发布于 2013-04-23 18:56:15
我为UINavigationController创建了一个类别。它在这里描述
How to force a UIViewController to Portrait orientation in iOS 6
https://stackoverflow.com/questions/16165058
复制相似问题