I'm trying to present the photo library, in a popover, on an iPad with iOS 9 beta 4 and Swift. The preferred way is through a popover, but UIPopoverController
is now deprecated. Apparently it's now done through UIViewController
, but there is no documentation, or sample code out there that I could find. Any help would be greatly appreciated!
Thank you!
The above answer is almost correct except that the anchor in the popoverPresentationController
must be set prior to calling presentViewController()
:
let myPicker = UIImagePickerController()
myPicker.delegate = self
myPicker.sourceType = .PhotoLibrary
myPicker.modalPresentationStyle = .Popover
let ppc = myPicker.popoverPresentationController
ppc?.barButtonItem = sender as? UIBarButtonItem
ppc?.permittedArrowDirection = .Any
presentViewController(myPicker, animated: true, completion: nil)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With