我将应用方向锁定为像这样的常规应用设置中的纵向

但是当我在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
}
}
Run Code Online (Sandbox Code Playgroud)
这张照片取自我的应用程序的主导航控制器.

还是没用!
这个东西怎么样?
我有一个项目使用UINavigationController和segues工作正常,所有这些都正确旋转,事情是......我只是想禁用autorotation特定的UIViewController.我试过这个:
- (BOOL)shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation)interfaceOrientation {
return NO;
}
// New Autorotation support for iOS 6.
- (BOOL)shouldAutorotate NS_AVAILABLE_IOS(6_0){
return NO;
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
Run Code Online (Sandbox Code Playgroud)
但它不起作用,我UIViewController会自动旋转,欢迎任何帮助:)