如何在iOS 7和iOS 8中锁定设备方向 [英] How to lock device orientation in iOS 7 and iOS 8

查看:158
本文介绍了如何在iOS 7和iOS 8中锁定设备方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用有问题。我无法锁定我的应用的方向。我需要做的就是将一个视图控制器锁定到横向模式,其余的都是纵向。

I have a problem with my app. I cannot lock the orientation of my app. All I need to do is to lock one view controller to landscape mode and the rest are portrait.

这是我的应用程序的层次结构。

This is hierarchy of my app.

*Navigation Controller
     *TabBarController
          *ViewControllers


推荐答案

使用NavigationController

With NavigationController

-(BOOL)shouldAutorotate 
-(NSUInteger)supportedInterfaceOrientations
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation

这些方法如果您使用'show segue(push)',则永远不会被调用。

these method are never called , if you use 'show segue(push)'.

更改segue'showDetail'而不是'show'

change segue 'showDetail' instead 'show'

这篇关于如何在iOS 7和iOS 8中锁定设备方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆