【发布时间】:2015-11-08 06:25:14
【问题描述】:
最近我的应用被 App Review 拒绝了,因为我没有使用 Popover。 然后我将我的编码更改为以下。但我仍然没有在模拟器中弹出窗口。
总是得到正常的iPhone照片选择方法,它使应用程序崩溃。
而且它甚至没有打印“工作”。
@IBAction func chooseGallery(sender: UIBarButtonItem) {
imagePicker.sourceType = .PhotoLibrary
//imagePicker.modalPresentationStyle = .Popover
//presentViewController(imagePicker, animated: true, completion: nil)//4
//imagePicker.popoverPresentationController?.barButtonItem = sender
if UIDevice.currentDevice().userInterfaceIdiom == .Phone {
self.presentViewController(imagePicker, animated: true, completion: nil)
}
else {
println("Working")// to test this part
imagePicker.modalPresentationStyle = .Popover
presentViewController(imagePicker, animated: true, completion: nil)//4
imagePicker.popoverPresentationController?.barButtonItem = (sender)
imagePicker.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection.Up
imagePicker.popoverPresentationController?.sourceRect = CGRect(x: 150, y: 150, width: 0, height: 0)
}
}
【问题讨论】:
-
我找到了答案。我没有在目标设备中使用
universal
标签: ios iphone swift ipad popover