如何在任何其他视图上创建菜单查看它的意思是我创建了一个UIView,我想在其上添加MenuButton。这是我的代码,但它不能正常工作。该UIView的是隐藏MuneButton ..如何在任何其他视图上创建菜单cocos2D
UIView *aview;
aview = [[UIView alloc]initWithFrame:CGRectMake(50, 50, 300,250)];
aview.backgroundColor= [UIColor redColor];
[[[CCDirector sharedDirector] openGLView] addSubview:aview];
// Standard method to create a button
CCMenuItem *menuItem1 = [CCMenuItemImage
itemFromNormalImage:@"Icon.png" selectedImage:@"Icon.png"
target:self selector:@selector(NextButton:)];
menuItem1.position = ccp(100, 60);
CCMenu *starMenu = [CCMenu menuWithItems:menuItem1, nil];
starMenu.position = CGPointZero;
[self addChild:starMenu];
和
(void) NextButton: (CCMenuItem *) menuItem
{
NSLog(@"Button1");
}
如何增加对UIView的菜单。我尝试使用AddSubview删除addChild。我试图删除自己..
我新的cocos2D所以我不知道如何创建layer.can你详细解释示例代码。 – triveni