I have a CCMenuItem declared in a .h file
CCMenuItemImage* button2 ;
I implemented it in an init statement of a .m file
button2 = [CCMenuItemImage itemFromNormalImage:@"Levels.png" selectedImage:@"Levels.png" target:self selector:@selector(switchScenelevels)];
levelbutton = [CCMenu menuWithItems:button2, nil];
levelbutton.position = levelstartpostion;
[self addChild:levelbutton z:depthScore];
I need to hide this button when something occurs in my application.
I did the following to hide button2:
-(void)resetgameee
{
[button2 setVisible:NO];
}
but no luck; it is still visible in the screen. I also do:
-(void)resetgameee
{
[button2.isEnabled:NO];
}
which didn’t work
How can I disable or hide this button?
you can try with this:
+ (id) itemFromNormalImage: (NSString *) value
selectedImage: (NSString *) value2
disabledImage: (NSString *) value3
target: (id) r
selector: (SEL) s
if you want the button disappear you can put a transparent image in disabledImage, now
[button2.isEnabled:NO];sould work and put the disabledImage on the screen