UIActionSheet更改箭头位置? [英] UIActionSheet Change arrow position?
问题描述
要在iPad上显示UIActionSheet我做了这个:
To show a UIActionSheet on the iPad I did this:
[actionSheetX showFromRect:RectX inView:myView animated:YES];
弹出窗口的箭头指向下方,我可以将此位置更改为左侧,上方或右侧,比如使用普通的popover吗?
The arrow of the popover points down, can I change this position to point left, up or right, like when using a normal popover?
推荐答案
Apple不提供对UIActionSheet内部实现<$ c的内部结构的任何访问权限$ c> showFromRect ,但是就箭头方向而言,实际上有一种非常黑客的解决方法,可以将箭头方向改变为所需的方向。
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.
诀窍是弄乱中的rect参数 - (void)showFromRect:(CGRect)rect inView(UIView *)view animated:(BOOL )动画
。 Apple没有很好地记录这个rect参数,但是如果你的原始rect会给你一个向下箭头的方向,请输入一个大的高度和负数的origin.y将推动动作表一直向上移动因此显示向上箭头方向。这是一个极端的黑客攻击,但它在整个固件中运行一致。希望能帮助到你。
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.
这篇关于UIActionSheet更改箭头位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!