Question

now i'm working with cocos2d and i design to add navigationcontroller to my cocos2d application, so i add navigationcontroller to my application when i click it not pass touch or event to cocos2d

now i'm try to override UINavigationController by add new new class name is NavigationController and inherit from UINavigationController

in init i call [super init]; every things look be ok

but when i try to add

- (BOOL)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSLog(@"Im overriding touch");
    return YES;

}



- (BOOL)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSLog(@"Im overriding touchMove");
    return YES;
}

it not call

Was it helpful?

Solution

Why are you calling the methods ccTouchesBegan:withEvent: and ccTouchesMoved:withEvent: instead of the original names? You don't have to change the names of the methods when you subclass UINavigationController; instead, you should keep the same names and call super on them as well as appropriate. For example:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSLog(@"I'm overriding touch");
    [super touchesBegan:touches withEvent:event];
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSLog(@"I'm overriding move");
    [super touchesMoved:touches withEvent:event];
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top