gpt4 book ai didi

ios - preferredInterfaceOrientationForPresentation 不工作

转载 作者:行者123 更新时间:2023-11-29 01:16:36 29 4
gpt4 key购买 nike

我试图以编程方式强制一个弹出 View 为横向,同时我在项目设置中将应用程序的设备方向设置为纵向。我的代码如下所示:

override func shouldAutorotate() -> Bool {
return true
}

override func preferredInterfaceOrientationForPresentation() -> UIInterfaceOrientation {
return UIInterfaceOrientation.LandscapeLeft
}

这没有用,所以我尝试添加:

override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.All
}

但是还是没有轮换。为什么会发生这种情况?

最佳答案

只有在 View Controller 是 View Controller 或全屏显示 View Controller 时, View Controller 才有发言权。您的 View Controller (弹出窗口)都不是;因此它在轮换中没有发言权。

关于ios - preferredInterfaceOrientationForPresentation 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35109052/

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