设置UIMenuController箭头方向不工作 [英] Setting UIMenuController arrow direction not working

查看:449
本文介绍了设置UIMenuController箭头方向不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 UIMenuController ,我已经添加了一些额外的项目。我想要的菜单是我选择的文本,所以我尝试:

I have a UIMenuController which I have added a few extra items to. I would like the menu to be BELOW the text that I select, so I tried:

[UIMenuController sharedMenuController].arrowDirection = UIMenuControllerArrowDown;

这似乎什么都不做,我尝试的一切,不会把菜单放在文本下面。

That seemed to do nothing, and everything I try, won't put the menu below the text.

我如何做到这一点?

推荐答案

a href =http://developer.apple.com/library/ios/#DOCUMENTATION/iPhone/Reference/UIMenuController_Class/UIMenuController.html =nofollow> docs , arrowDirection 设置箭头方向;它与菜单相对于其目标区域的位置无关。它看起来像他们不给你任何控制菜单的定位超过 setTargetRect:inView

According to the docs, arrowDirection sets the direction the arrow points; it has nothing to do with the location of the menu relative to its target area. It also looks like they don't give you any control over the positioning of the menu beyond setTargetRect:inView.

如果你真的想把菜单放在文本下面,你可以设置一个假的目标区域,改变箭头方向指向 感兴趣的区域。

If you really want to put the menu below the text, you might be able to set a "fake" target area and change the arrow direction to point to the "real" area of interest.

但是,这可能是苹果这样做的一个原因。我猜?如果你用手指选择一些文本,你的手可能会遮蔽屏幕下方的文本部分...所以这不是很有帮助,如果菜单出现在那里。走出你的方式来破坏与标准UI约定的一致性通常不值得的努力。

However, there's probably a reason Apple does it this way. My guess? If you select some text with your finger, your hand is probably obscuring the part of the screen below the text... so it's not very helpful if the menu appears there. Going out of your way to break consistency with standard UI conventions isn't usually worth the effort.

这篇关于设置UIMenuController箭头方向不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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