gpt4 book ai didi

ios - 禁止在 iOS 8 中为 UIModalPresentationCustom modalPresentationStyle 旋转

转载 作者:行者123 更新时间:2023-11-29 12:37:41 24 4
gpt4 key购买 nike

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

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

在我设置的这个 UIViewController 中

- (BOOL)shouldAutorotate
{
return NO;
}

但我可以在 self 呈现时旋转此 viewController,当我使用 self.modalPresentationStyle =UIModalPresentationCurrentContext 时,它不会 clearColor 但不能旋转。 UIModalPresentationCustom 样式如何禁止旋转?

最佳答案

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

对我有用的是使用 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 及更高版本。

关于ios - 禁止在 iOS 8 中为 UIModalPresentationCustom modalPresentationStyle 旋转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25840626/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com