Ios Cocos3D handleTouch:类型:无法识别
当我尝试通过取消注释以下功能(如文档中所建议)来激活触摸移动支持时: 我发现编译错误:Ios Cocos3D handleTouch:类型:无法识别,ios,cocos2d-iphone,cocos3d,Ios,Cocos2d Iphone,Cocos3d,当我尝试通过取消注释以下功能(如文档中所建议)来激活触摸移动支持时: 我发现编译错误: No visible @interface for 'CC3HelloWorldLayer' declares the selector 'handleTouch:ofType:' 此函数在CC3layer继承的CCLayer.h中声明 该奇怪错误的原因是什么?类型:的handleTouch:未在CCLayer.h中声明为(公共)方法,或者CC3HelloWorldLayer类未直接或通过其父类CC3La
No visible @interface for 'CC3HelloWorldLayer' declares the selector 'handleTouch:ofType:'
此函数在CC3layer继承的CCLayer.h中声明
该奇怪错误的原因是什么?类型:的
handleTouch:未在CCLayer.h中声明为(公共)方法,或者CC3HelloWorldLayer类未直接或通过其父类CC3Layer从CCLayer.h继承
您确实说这两种情况都是如此,但我不太相信,因为这可能是发生此错误的唯一两个原因。类型:
的handleTouch:ofType:
方法在CC3Layer.m
中定义为受保护的方法,需要在使用它的任何子类文件中重新声明(它没有公共可见性)
由于疏忽,CC3HelloWorldLayer.m
文件中缺少重新声明。我会在以后的版本中修复这个问题
同时,将以下内容添加到CC3HelloWorldLayer.m
文件的顶部:
@interface CC3Layer (TemplateMethods)
-(BOOL) handleTouch: (UITouch*) touch ofType: (uint) touchType;
@end
有关示例,请参见TileLayer.m
和CC3DemoMashUpLayer.m
文件
…法案
@interface CC3Layer (TemplateMethods)
-(BOOL) handleTouch: (UITouch*) touch ofType: (uint) touchType;
@end