popscene in cocos2d problems
i am new to cocos2d.In my game am using "cctouchesbegan" to push a new scene.Using "popScene" am coming to my first scene from second scene.After coming to first scene开发者_如何学C my "cctouchesbegan" delegate method not working... If any idea,it will be helpful .
put "NO" when you are adding the targettedDelegate as shown below.It corrects my error [[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:NO]
You can do the following:
-(void)onEnter
{
[super onEnter];
[[CCTouchDispatcher sharedDispatcher] removeDelegate: self];
[[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];
self.isTouchEnabled = YES;
}
- (void) onExit {
[[CCTouchDispatcher sharedDispatcher] removeDelegate: self];
[super onExit];
}
精彩评论