【发布时间】:2015-08-10 12:45:54
【问题描述】:
我需要屏蔽屏幕。我正在使用下一个功能:
override func shouldAutorotate() -> Bool {
return false
}
override func supportedInterfaceOrientations() -> Int {
return UIInterfaceOrientation.Portrait.rawValue
}
但问题是我有一个显示警报功能,
func showAlert(message: String) {
self.viewUtils.hideActivityIndicator(self.view)
let alertView = UIAlertController(title: "Oops", message: message, preferredStyle: UIAlertControllerStyle.Alert)
alertView.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default, handler: nil))
self.presentViewController(alertView, animated: true, completion: nil)
//activity.hidden = true
}
当我调用它时,我看到了错误:
由于未捕获的异常而终止应用程序
'UIApplicationInvalidInterfaceOrientation',原因:'支持的方向与应用程序没有共同的方向,并且[UIAlertController shouldAutorotate]返回YES'
【问题讨论】: