I show a popover controller in my IPad app:
[self.programMapPopOver presentPopoverFromRect:anchor.frame
                        inView:anchor.superview
                        permittedArrowDirections:UIPopoverArrowDirectionAny 
                        animated:YES];
My problem is with anchor: I'd like to set an UIBarButtonItem* as its anchor, but it is not an UIView*, but inView is a view* parameter.
How can I solve this?
Thanks to all!
In iOS 8 & 9, the presentPopoverFromBarButtonItem:permittedArrowDirections:animated: method is deprecated. You'll want to set the barButtonItem property on the view controller's popoverPresentationController property.
let popover = UIViewController()
popover.modalPresentationStyle = .Popover
if let presentation = popover.popoverPresentationController {
    presentation.barButtonItem = navigationItem.rightBarButtonItem
}
presentViewController(popover, animated: true, completion: nil)
You need to use presentPopoverFromBarButtonItem:permittedArrowDirections:animated:.
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