I have 2 CCMenuIte开发者_StackOverflow社区ms A and B
A is a screen-wide transparent button and B is an actual button that is set to visible when A is touched
Currently, when I'm touching B, A responds with it's selector method and basically B does not respond because the touch is 'taken' by A's selector.
I need B to be responding even though A is a screen-wide button so- Is it possible to prioritise B's selector when it is pushed?
To summarize, I'm toggling B's visibility via A and would like to be able to use B when it is visible.
Is this possible? How can it be done?
for me worked adding one menu in one layer and another menu in other layer
I)
Yes, You can prioritize your CCMenuItems
by setting Z-Order.
First button that gets touch is the button with lowest Z-Order.
II)
And if you want to prioritize your CCMenu
s, you need to setTouchPriority(..)
them.
The less priority you give, the earlier your CCMenu
will handle the touch. (CCMenu
's default value is -128 ).
Either you can set the buttons yourButton.isEnabled to NO or you can just move the A-button off the scene when you don't want it to take input.
It's possible to use an additional CCMenu with a higher z-order for the button B.
精彩评论