Objective c 目的-C遗传问题
我正在做以下工作:Objective c 目的-C遗传问题,objective-c,inheritance,Objective C,Inheritance,我正在做以下工作: #import <Foundation/Foundation.h> #import "CCMenuItem.h" @interface SmartMenuItem : CCMenuItemSprite { } @end 我收到了错误和警告。菜单接受CCMenuItemSprite作为子项。但xcode表示:无法使用SmartMenuItem*类型的左值初始化CCNode*类型的参数 当我创建playItem和options项目:找不到方法时,它还会发出警
#import <Foundation/Foundation.h>
#import "CCMenuItem.h"
@interface SmartMenuItem : CCMenuItemSprite {
}
@end
我收到了错误和警告。菜单接受CCMenuItemSprite
作为子项。但xcode表示:无法使用SmartMenuItem*
类型的左值初始化CCNode*
类型的参数
当我创建playItem
和options项目
:找不到方法时,它还会发出警告。但这是一个静态的CmenuItemSprite方法
什么问题?解决了。问题在于向xcode项目添加文件。他们被错误地分享了
SmartMenuItem *playItem = [SmartMenuItem itemFromNormalSprite:play
selectedSprite:playPressed
target:self
selector:@selector(onPlayPressed)];
SmartMenuItem *optionsItem = [SmartMenuItem itemFromNormalSprite:options
selectedSprite:optionsPressed
target:self
selector:@selector(onOptionsPressed)];
[menu_ addChild:playItem];
[menu_ addChild:optionsItem];