CCMenu responds to touches when touched elsewhere

旧巷老猫 提交于 2019-12-08 07:56:49

问题


This is the code I'm using to display the menu.

CCMenu *topMenu = [CCMenu menuWithItems:menuItem1, menuItem2, menuItem3, menuItem4, menuItem5, menuItem6, menuItem7, menuItem8, nil];
[topMenu alignItemsHorizontallyWithPadding:0.0f];
topMenu.position = ccp(winSize.width/2, 725);
[self addChild:topMenu];

I'm sure that this menu gets added only once. But for some strange reasons, touching on the area shown in the attached photo activates my menu. (You can see the "Home" menu item selected when my finger is totally somewhere else.

Touching on areas slightly to the right makes the "Level" menu activate and touching areas further right makes "Chapters" menu activate. It appears as if there is another "invisible" menu getting added.

The right pane is a UIViewController from a XIB adding onto the CCDirector's view. I'm currently eating touches in this view controller to avoid the said behaviour. Any ideas why this is happening?

来源:https://stackoverflow.com/questions/14805334/ccmenu-responds-to-touches-when-touched-elsewhere

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!