我正在使用 iOS 8 的 UIPresentationController 编写自定义模式演示文稿。呈现的控制器具有首选的界面方向UIInterfaceOrientationLandscapeLeft
。
在使用 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 考虑到所呈现控制器的首选接口OrientationForPresentation 方法的结果?