现在我正在使用cocos2d,我设计将navigationcontroller添加到我的cocos2d应用程序, 所以当我点击它而不是将触摸或事件传递给cocos2d时,我将navigationcontroller添加到我的应用程序
现在我试图通过覆盖UINavigationController 添加新的新类名是NavigationController并从UINavigationController继承
在init中调用[super init]; 每件事看起来都没问题
但是当我尝试添加
时- (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;
}
不打电话
答案 0 :(得分:0)
为什么要调用方法ccTouchesBegan:withEvent:
和ccTouchesMoved:withEvent:
而不是原始名称?在继承UINavigationController时,您不必更改方法的名称;相反,你应该保持相同的名称并在它们上面调用super
。例如:
- (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];
}