App中其它界面都是竖屏, 只有一个界面是需要横屏的, 怎样使这个界面强制横屏布局?
使用如下这种方式,在需要横屏的页面添加。
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
}
2 回答1.1k 阅读
1 回答1.2k 阅读✓ 已解决
1 回答2.8k 阅读
1 回答1.4k 阅读
1.7k 阅读
1 回答949 阅读
1 回答789 阅读
如果需要特定ViewController旋转, 可以为UINavigationController添加Category(类目)UINavigationController+InterfaceOrientation, 然后在指定的ViewController中调用即可.
另外, 推荐一篇博文: http://www.molotang.com/articles/1530.html. 对于不同级别的屏幕旋转梳理的较为清晰.