This seems like it should be simple enough, but I cannot find the answer. I have created a CCButton using the function below. Now when an event occurs, I want the CCButton that I return from this function to have its image (spriteFrame) change to another image. Can someone tell me what I need to do?
+ (CCButton*) drawBitmap :(id)not_self :(NSString*)normalImage :(double)x :(double)y :(double)w :(double)h withSelector:(SEL)sel :(NSString*)buttonName
{
CGSize size = [[CCDirector sharedDirector] viewSize];
double middleX = size.width * (w/2 + x);
double middleY = size.height * (1 - y - h/2);
CCButton *btn = [CCButton buttonWithTitle:@""
spriteFrame:[CCSpriteFrame frameWithImageNamed:normalImage]
highlightedSpriteFrame:[CCSpriteFrame frameWithImageNamed:normalImage]
disabledSpriteFrame:[CCSpriteFrame frameWithImageNamed:normalImage]];
[btn setName:buttonName];
[btn setTarget:not_self selector:sel];
btn.positionType=CCPositionTypeNormalized;
[btn setScaleX: (size.width * w)/btn.contentSize.width];
[btn setScaleY: (size.height * h)/btn.contentSize.height];
btn.position = ccp(middleX/size.width , middleY/size.height);
btn.cascadeOpacityEnabled=YES;
[not_self addChild:btn];
return btn;
}