I have a view controller that I want to present modally if the horizontal size class is compact, and with a custom transitioning delegate otherwise, like so:
if traitCollection.horizontalSizeClass == .Compact {
settingsViewController.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Done, target: self, action: "dismissSettings")
} else {
navigationController.transitioningDelegate = drawerTransitioningDelegate
navigationController.modalPresentationStyle = .Custom
}
presentViewController(navigationController, animated: true, completion: nil)
I want to do something similar to what Apple does with form sheets on an iPhone 6 Plus. In landscape, the view is a form sheet with a dimmed background, while in portrait the view is a full screen modal view controller. More importantly, it transitions beautifully when rotating the device. How can I set up my view and presentation in the same way?
请参见adaptivePresentationStyleForPresentationController
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.