Last active
February 13, 2016 11:37
-
-
Save NickAger/3bf0919e20d25aa7a880 to your computer and use it in GitHub Desktop.
Popover on iPhone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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