UIActionSheet 更改箭头位置? [英] UIActionSheet Change arrow position?

查看:25
本文介绍了UIActionSheet 更改箭头位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了在 iPad 上显示 UIActionSheet,我这样做了:

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?

推荐答案

对于UIActionSheet的showFromRect的内部实现,Apple没有提供任何内部结构的访问,但是关于箭头方向,其实有解决此问题的一种非常hack-y的方法,并且能够将箭头方向更改为所需的方向.

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)animated.Apple 没有很好地记录这个 rect 参数,但是如果你的原始 rect 会给你一个向下的箭头方向,请输入一个高度和负数 origin.y 的矩形.y 会一直向上推动操作表弹出窗口从而显示向上的箭头方向.这是一个极端的 hack,但它在固件中始终如一地工作.希望能帮助到你.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆