Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIActionSheet Change arrow position?

Tags:

To show a UIActionSheet on the iPad I did this:

[actionSheetX showFromRect:RectX inView:myView animated:YES]; 

The arrow of the popover points down, can I change this position to point left, up or right, like when using a normal popover?

like image 758
lbadias Avatar asked Sep 21 '10 18:09

lbadias


1 Answers

Apple doesn't provide any access to internal structure for UIActionSheet's internal implementation of showFromRect, but as for arrow direction, there is actually a very hack-y way to work around this and sort of being able to change arrow direction to a desired direction.

Trick is to mess around the rect parameter in - (void)showFromRect:(CGRect)rect inView (UIView *)view animated:(BOOL)animated. Apple doesn't document this rect parameter very well, but if your original rect will give you a down arrow direction, feed in a rect with a large height and negative number origin.y will kind of push the action sheet popover all the way up thus showing a upward arrow direction. This is a extreme hack but it works consistently across firmware. Hope it helps.

like image 154
overboming Avatar answered Oct 09 '22 10:10

overboming