我在导航栏中有一个条形按钮项,当按下它时,将呈现一个样式为.ActionSheet
的UIAlertController
。在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
有人知道如何将“栏按钮项”用作sourceView
和sourceRect
的方法吗?我希望弹出视图指向该栏按钮项。