gpt4 book ai didi

swift - 如何默认将某些 View Controller 设置为横向模式,将其他 View Controller 设置为纵向模式

转载 作者:行者123 更新时间:2023-11-30 14:04:43 25 4
gpt4 key购买 nike

如何默认将某些 View Controller 设置为横向模式,将其他 View Controller 设置为纵向模式。无需旋转。我需要将其仅横向或仅纵向。

override func shouldAutorotate() -> Bool {

return false

}



override func supportedInterfaceOrientations() -> Int {

return Int(UIInterfaceOrientationMask.Landscape.rawValue)

}

对于肖像

    override func supportedInterfaceOrientations() -> Int {

return Int(UIInterfaceOrientationMask.Portrait.rawValue)

}

无法正常工作

我使用的是 xcode 6.4。 ios 8

提前致谢

最佳答案

将其添加到您的 AppDelegate:

func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.All
}

Asks the delegate for the interface orientations to use for the view controllers in the specified window

关于swift - 如何默认将某些 View Controller 设置为横向模式,将其他 View Controller 设置为纵向模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32560743/

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