how to close layer that showed in other layer in cocos2d-iphone
- by yegomo
I have one layer called alayer, and there is a button called abutton, when click the button, another layer called blayer will show in alayer, not replaceScene, please look at the following code,
alayer.m
-(void)abuttonclicked:(id)sender
{
blayer *blayer = [blayer node];
blayer.position = ccp(1,1);
[self addChild:blayer];
}
blayer.m has a button called bbutton and string value called bstring, I want to click the b button, it will close blayer (remove blayer from alayer), and pass the string value bstring to alayer, please look at following code,
-(void)bbuttonclicked:(id)sender
{
// how can do here to close its self(remove its self from alayer), and pass the bstring to alayer?
}
thanks.
ps. I can use NSUserDefault to pass the string value, but I think it's a bad way to do this, is there another way to pass value?