I'm making a pop over presentation view controller where I need to use multiple arrow directions (up
and down
). For having multiple permittedArrowDirections
I've followed Set Multiple Arrow Directions on UIPopoverController in Swift. Also I tweaked the background color of the pop over so that the arrow blends in with the background dimming view.
The problem is, I need to prefer the UIPopoverArrowDirection.up
for almost all cases but for the cases where there is not enough space in right below the source view only then the UIPopoverArrowDirection.down
should be used. But I can't find to figure it out. The code snippet is:
let presentationController = .....
presentationController.sourceView = sourceView
presentationController.sourceRect = sourceView.bounds
// changing the array order doesn't help
presentationController.permittedArrowDirections = [.up, .down]
presentationController.backgroundColor = UIColor(white: 0, alpha: 0)
self.present(controller, animated: true)
For making it clear I'm attaching the current output:
The source for the demo that I've tried can be found here if anyone needs to follow along.