操作表源视图栏按钮项



>我在导航栏中有一个栏按钮项目,按下时,将显示一个样式为.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的方法?我希望弹出框指向栏按钮项。

只需使用popOver?.barButtonItem = myBarButtonItem

最新更新