禁止在iOS 8中对UIModalPresentationCustom modalPresentationStyle进行旋转 [英] Prohibit rotation in iOS 8 for UIModalPresentationCustom modalPresentationStyle

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

问题描述

我用它来在iOS 8中呈现一个clearColor UIViewController:

I use this to present a clearColor UIViewController in iOS 8:

 self.modalPresentationStyle = UIModalPresentationCustom;
 [_rootViewController presentViewController:self animated:NO completion:nil];

在此UIViewController中,我设置

In this UIViewController I set

- (BOOL)shouldAutorotate
{
  return NO;
}

但是我可以在自我展示时旋转此viewController,当我使用self.modalPresentationStyle =UIModalPresentationCurrentContext时,它不会清除Color但不能旋转.对于UIModalPresentationCustom样式如何禁止旋转?

But I can rotate this viewController when self is presenting, When I use self.modalPresentationStyle =UIModalPresentationCurrentContext it will not clearColor but can not rotate. For UIModalPresentationCustom style how to prohibit rotation?

推荐答案

我还尝试在iOS 8+中选择UIModalPresentationCustom呈现清晰的UIViewController颜色,但未能禁止自动旋转.

I also tried to present a clear color UIViewController in iOS 8+ choosing UIModalPresentationCustom but failed to prohibit autorotation.

对我有用的是使用UIModalPresentationOverFullScreen,而自动旋转方法按预期工作:

What worked for me was using UIModalPresentationOverFullScreen instead and the autorotation methods worked as intended:

UIModalPresentationOverFullScreen

UIModalPresentationOverFullScreen

一种视图呈现样式,其中 呈现的视图覆盖了屏幕.所呈现的观点 演示文稿时,内容不会从视图层次结构中删除 完成.因此,如果显示的视图控制器未填满屏幕 内容不透明,底层内容就会显示出来.

A view presentation style in which the presented view covers the screen. The views beneath the presented content are not removed from the view hierarchy when the presentation finishes. So if the presented view controller does not fill the screen with opaque content, the underlying content shows through.

在iOS 8.0和更高版本中可用.

Available in iOS 8.0 and later.

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

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