Search code examples
iosuipopovercontroller

change arrow placement in UIPopoverController


i have a UIPopoverController however, due to design, i must place the arrow differently. Again, this is arrow PLACEMENT, NOT ARROW DIRECTION

in other words, by default, the arrow is placed at the centre of the UIPopoverController like the follow:

 -----^-----
 |         |
 |         |
 |         |
 |_________|

i would like the following for my arrow placement

 --^--------
 |         |
 |         |
 |         |
 |_________|

is this possible?

Thanks


Solution

  • The arrow actually points towards the rect that you provide in:

    presentPopoverFromRect:inView:permittedArrowDirections:animated:
    

    It appears in the center because the popover view tries to appear center-aligned with that provided rectangle. If you present the popover with that rect in a difficult-to-appear place such as a corner of the screen, it will get as close as it can, but won't necessarily be centered.

    Unfortunately, you can't really change this behavior as it is internalized in the class, in order to preserve Apple/Cocoa UI guidelines and behavior.