Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ipad PresentFromBarButtonItem but use UIButton

Tags:

ipad

uibutton

The Popover function "PresentFromBarButtonItem" uses a UIBarButtonItem to display the Popover in a nice place relative to the UIBarButton

Is there a way to get the same outcome behavior but with a UIButton? I would imagine there is some more code, but a way to do so relative the button would be very helpful.

like image 994
Ian Vink Avatar asked Dec 06 '25 08:12

Ian Vink


1 Answers

Do you mean presentPopoverFromBarButtonItem instead of PresentFromBarButtonItem?

To popup from a UIButton (or any UIView) you can use presentPopoverFromRect:

//button is some UIButton...
[popoverController presentPopoverFromRect:button.bounds inView:button 
    permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];