Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 471
user1118019 Avatar asked Oct 25 '25 01:10

user1118019


2 Answers

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.

like image 86
CrimsonDiego Avatar answered Oct 26 '25 14:10

CrimsonDiego


Try to use popoverLayoutMargins and set the left margin as you need.

like image 43
mohamede1945 Avatar answered Oct 26 '25 16:10

mohamede1945



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!