Created
July 13, 2016 21:25
-
-
Save bizz84/1f43f6790dbce9d0e2bf031cd4805a94 to your computer and use it in GitHub Desktop.
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 ViewController: UIViewController, UIPopoverPresentationControllerDelegate { | |
@IBAction var sourceButton: UIButton! | |
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { | |
if segue.identifier == "SlideshowPopoverSegue" { | |
let contentViewController = segue.destinationViewController | |
contentViewController.modalPresentationStyle = UIModalPresentationStyle.Popover | |
if let popover = contentViewController.popoverPresentationController { | |
popover.delegate = self | |
// Set the sourceView and sourceRect so that the popover knows | |
// where to position itself | |
popover.sourceView = sourceButton | |
popover.sourceRect = sourceButton.bounds | |
} | |
} | |
} | |
// MARK: UIPopoverPresentationControllerDelegate | |
func adaptivePresentationStyleForPresentationController( | |
controller: UIPresentationController) -> UIModalPresentationStyle { | |
return UIModalPresentationStyle.None | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment