问题
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.
How can I do that?
回答1:
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.
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.
来源:https://stackoverflow.com/questions/9798270/setting-uimenucontroller-arrow-direction-not-working