Ipad PresentFromBarButtonItem, but use UIButton

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

Is there a way to get the same result behavior, but using UIButton? I would suggest that there is still some code, but a way to do this relative to the button would be very useful.

+3
source share
2 answers

Do you mean presentPopoverFromBarButtonIteminstead PresentFromBarButtonItem?

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

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

button.frame not button.bounds

0
source

Source: https://habr.com/ru/post/1787467/


All Articles