我正在尝试在装有iOS 9 beta 4和Swift的iPad上以弹出框的形式呈现照片库。首选方式是通过弹出窗口,但现在不建议使用UIPopoverController
。显然,现在它是通过UIViewController
完成的,但是没有文档或我可以找到的示例代码。任何帮助将不胜感激!
谢谢!
最佳答案
上面的答案几乎是正确的,除了必须在调用popoverPresentationController
之前设置presentViewController()
中的 anchor :
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)
关于ios - 如何在带有iOS 9和Swift的Popover中呈现UIImagePickerController,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31845244/