在iOS 8中禁用UIViewController的旋转 [英] Disable Rotation of UIViewController in iOS 8

查看:110
本文介绍了在iOS 8中禁用UIViewController的旋转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想禁用在iOS 8中的我的应用程序中只旋转一个viewController。
我尝试使用一些旧方法,但它在iOS 8中无法正常工作或弃用。

I want to disable rotating only one viewController in my Application in iOS 8. I try with some older methods but it is not working or deprecated in iOS 8.

我在iOS 8中尝试这种新的旋转方法。

I try this new method of Rotation in iOS 8.

- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator

但我不知道如何禁用此循环方法。我只想在这个viewController中使用Landscape模式。我检查了其他问题,但我的代码仍然无法在iOS 8中运行。

but i don't know how to disable the rotation in this method. I want only Landscape mode in this viewController. I checked other SO question but my code still not working in iOS 8.

请帮助我。

推荐答案

现在这更容易了。尝试使用:

Now this is easier. Try using:

- (BOOL)shouldAutorotate {
    return NO;
}

这篇关于在iOS 8中禁用UIViewController的旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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