I have a bar button item in the navigation bar that when pressed, will present a UIAlertController
with the style as .ActionSheet
. In the iPhone it appears just the way that I want. For the iPad I know I need to add
// 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
Does anyone know of a way to use the bar button item as the sourceView
and the sourceRect
? I would like the popover to point to the bar button item.
Just use popOver?.barButtonItem = myBarButtonItem
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With