我有一个应用程序,适用于iPhone和iPad的布局。对于iPhone布局,我创建了操作表和Pop Over,而对于iPad,则是 Pop Over。问题在于 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)
UIBarButtonItem
。我已经将函数更改为@IBAction func userOptions(button: UIBarButtonItem)
,但它抛出了一个错误:[UIBarButtonItem bounds]: unrecognized selector sent
。 - Srujan Simhabounds
而不是frame
是我正在寻找的。谢谢! - Beltalowda