一个问题复盖UINavigationController
-
22-07-2019 - |
题
现在我的工作与cocos2d和我的设计中添加navigationcontroller我cocos2d应用程序, 因此我添加navigationcontroller我应用程序时,它并不通过触摸或事件cocos2d
现在我试图重写UINavigationController通过 添加新的类新名称是NavigationController和继承UINavigationController
在init我呼[超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;
}
它不呼叫
解决方案
为什么你打电话的方法 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];
}
不隶属于 StackOverflow