ActionSheet Source View BarButtonItem
Asked Answered
L

1

16

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.

Lafayette answered 29/4, 2015 at 16:23 Comment(0)
N
39

Just use popOver?.barButtonItem = myBarButtonItem

Normand answered 29/4, 2015 at 16:31 Comment(1)
PERFECT! Thanks I don't see how I missed that.Lafayette

© 2022 - 2024 — McMap. All rights reserved.