Search code examples
iosipaduibarbuttonitempopover

How Can I set UIBarButtonItem as anchor of a popover in IOS?


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!


Solution

  • You need to use presentPopoverFromBarButtonItem:permittedArrowDirections:animated:.