我正在使用iOS 8的UIPresentationController編寫自定義模態演示文稿。所呈現的控制器具有優選的界面方向UIInterfaceOrientationLandscapeLeft
。自定義模態演示文稿忽略preferredInterfaceOrientationForPresentation
在使用UIPresentationController呈現此控制器後,它將以縱向顯示,忽略呈現的控制器的preferredInterfaceOrientationForPresentation方法的結果。
呈現視圖控制器
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if let controller = segue.destinationViewController as? UIViewController {
controller.modalPresentationStyle = .Custom
controller.transitioningDelegate = self
}
}
func animationControllerForDismissedController(dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return nil
}
func animationControllerForPresentedController(presented: UIViewController, presentingController presenting: UIViewController, sourceController source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return nil
}
func presentationControllerForPresentedViewController(presented: UIViewController,
presentingViewController presenting: UIViewController!,
sourceViewController source: UIViewController) -> UIPresentationController? {
return UIPresentationController(presentedViewController: presented, presentingViewController: presenting)
}
提交 - 視圖 - 控制器
override func preferredInterfaceOrientationForPresentation() -> UIInterfaceOrientation {
return .LandscapeLeft
}
是否有可能有UIPresentationController考慮到所提出的控制器的preferredInterfaceOrientationForPresentation方法的結果?