【发布时间】:2015-03-05 13:39:44
【问题描述】:
我有一个与 iPhone 和 iPad 布局兼容的应用程序。对于 iPhone 布局,我为 iPad 创建了 Action Sheet 和 Pop over。问题是弹出的箭头没有指向我点击的按钮。下面是我的代码....
let actionSheet = UIAlertController(title: "Choose an option",
message: "Message",
preferredStyle: .ActionSheet)
...
if UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad
{
// for iPad
actionSheet.popoverPresentationController?.sourceView = self.view
actionSheet.popoverPresentationController?.sourceRect = self.view.bounds;
actionSheet.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection.allZeros;
}
self.presentViewController(actionSheet, animated: true, completion: nil)
【问题讨论】: