Skip to content

Instantly share code, notes, and snippets.

@NickAger
Last active February 13, 2016 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NickAger/3bf0919e20d25aa7a880 to your computer and use it in GitHub Desktop.
Save NickAger/3bf0919e20d25aa7a880 to your computer and use it in GitHub Desktop.
Popover on iPhone
class PopoverOnIPhone: UIViewController {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
modalPresentationStyle = .Popover
presentationController?.delegate = self
}
}
// MARK: UIAdaptivePresentationControllerDelegate
extension PopoverOnIPhone : UIAdaptivePresentationControllerDelegate {
func adaptivePresentationStyleForPresentationController(PC: UIPresentationController) -> UIModalPresentationStyle {
// This *forces* a popover to be displayed on the iPhone
return .None
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment