ActionSheet源视图BarButtonItem

16

我在导航栏中有一个条形按钮项,当按下它时,将呈现一个样式为.ActionSheetUIAlertController。在iPhone上,它看起来正是我想要的。对于iPad,我知道我需要添加

// For iPad, set the pop over bounds
var popOver = optionMenu.popoverPresentationController
popOver?.sourceView = button as UIView
popOver?.sourceRect = (button as UIView).bounds
popOver?.permittedArrowDirections = UIPopoverArrowDirection.Any

有人知道如何将“栏按钮项”用作sourceViewsourceRect的方法吗?我希望弹出视图指向该栏按钮项。

1个回答

39

只需使用 popOver?.barButtonItem = myBarButtonItem


完美!谢谢,我不知道我怎么会错过那个。 - Mike Walker

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接