2

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?

Eddie K
  • 503
  • 4
  • 18

1 Answers1

0

See adaptivePresentationStyleForPresentationController

malhal
  • 26,330
  • 7
  • 115
  • 133