gpt4 book ai didi

ios - 锁定方向不适用于 ipad ios 8 swift xcode 6.2

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:59:21 30 4
gpt4 key购买 nike

我从这样的一般应用设置中将应用方向锁定为纵向

portrait

但是当我在 ipad 上运行我的应用程序时,它仍然在旋转!?

那么我应该在哪里锁定方向?

为什么苹果将此功能添加到设置中,但它不起作用!?

更新:

我也尝试将此 viewController 实现为所有 viewController 的通用。

import Foundation
import UIKit

class GeneralViewController: UIViewController {

override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
let value = UIInterfaceOrientation.Portrait.rawValue
UIDevice.currentDevice().setValue(value, forKey: "orientation")
}

override func supportedInterfaceOrientations() -> Int {
return Int(UIInterfaceOrientationMask.Portrait.rawValue)
}


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

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

这张图片取 self 应用的主导航 Controller 。

Pic of answer 1

还是不行!

这到底是怎么回事?

最佳答案

您不需要额外的代码,我正在使用 Xcode 7.0.1,我注意到当我将屏幕方向锁定为仅纵向时,它仅在 iPhone 中锁定,要在 iPad 中也锁定它,您需要选择从 Devices(而不是 Universal)中选择 iPad 并检查纵向并取消选中其他,然后再次将 Devices 返回到 Universal,因为我发现 Universal 仅反射(reflect)在 iPhone 中,这可能是 Xcode 中的某种错误。

关于ios - 锁定方向不适用于 ipad ios 8 swift xcode 6.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55490424/

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