ios 5下设置屏幕方向为landscape

问题:

在ios6之下,只要在Target的summary中设置成如下即可。

这个对ios6管用,但对ios5不管用。网上有人说在Info.plist中设置

Initial interface orientation = Landscape (left home button)

试验了一下,ios5下仍然不管用。

 

解决方案。

在每个屏幕方向需要变换成landscape的viewController中添加如下代码即可。

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {

    return toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight;

}

posted on 2013-04-23 17:15  深圳市路云信息科技有限公司  阅读(391)  评论(0编辑  收藏  举报