ios - 如何在 iOS 6 中强制方向为纵向

标签 ios orientation

我正在使用带有 4 个 UINavigationController 的 UITabBarController。

在第四个 ViewController 中,我想将其方向限制为仅纵向, 我正在使用以下方法,但这些方法对我不起作用, 请帮助我。

-(NSUInteger)supportedInterfaceOrientations
{
     return UIInterfaceOrientationMaskPortrait;
}

-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
     return UIInterfaceOrientationPortrait;
} 

最佳答案

现在我使用自定义的 UITabBarController 如下...

CustomTabBarController.m

-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationPortrait;
}

在 ViewControllerToBePorted.m 中

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeLeft;
}

-(BOOL)shouldAutorotate{
return NO;

}

感谢回复..

关于ios - 如何在 iOS 6 中强制方向为纵向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19679358/

相关文章:

iphone - 如何设置 UIStepper 实例的背景颜色?

ios - 检测所有应用程序的手势

python-2.7 - OpenCV 2.4.8 (Python) 确定箭头的方向

android - 在没有 GPS 的情况下获取设备移动方向

ipad - 针对将部署目标设置为 3.2 的 iOS4.2 进行构建会导致方向问题

ios - 检查给定的 PHAsset 是 iCloud Assets 吗?

ios - 连接 UISlider 和 UITextField 选择正确的数据 - 简单的贷款分期计算器

ios - 在 WKWebView 中点击按钮后 UIButton 选择器不起作用

ios - UISplitViewController - 在 vi​​ewDidLoad 上显示主视图的弹出窗口

rotation - 嵌入式linux framebuffer旋转