0
我做了以下内容:Objective-C的继承问题
#import <Foundation/Foundation.h>
#import "CCMenuItem.h"
@interface SmartMenuItem : CCMenuItemSprite {
}
@end
然后,我想用我的类:
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];
,我得到了错误和警告。菜单接受CCMenuItemSprite
作为孩子。但xcode说:不能初始化类型为CCNode*
的参数,类型为SmartMenuItem*
。
而且它在创建playItem
和optionsItem
时发出警告:未找到方法。但它是CCmenuItemSprite的静态方法!
有什么问题?