Lukas Lukas - 29 days ago 7
iOS Question

iOS Present Popover from bar button item bottom

I have an

UIPopoverController
that presents an
UIViewController
using this method:

[self.popover presentPopoverFromBarButtonItem:self.infoBarButtonItem
permittedArrowDirections:UIPopoverArrowDirectionUp
animated:YES];


self.popover
is my
UIPopoverController
.

The code works well, but the Popover arrow is in the middle of the
BarButtonItem
how do I display the Popover with its arrow "under" the button?

This is what it currently looks like:

altText

Answer Source

How about this

UIBarButtonItem *item = self.infoBarButtonItem ;

UIView *view = [item valueForKey:@"view"];

if(view){

        CGRect frame=view.frame;

        [self.popover presentPopoverFromRect:frame
                                      inView:view.superview
                    permittedArrowDirections:UIPopoverArrowDirectionUp
                                    animated:YES];



}