[英]Objective-C inheritance problem
I'm doing the following: 我正在执行以下操作:
#import <Foundation/Foundation.h>
#import "CCMenuItem.h"
@interface SmartMenuItem : CCMenuItemSprite {
}
@end
Then I want to use my class: 然后我要使用我的课程:
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];
And i got errors and warnings. 而且我得到了错误和警告。 Menu accepts
CCMenuItemSprite
as child. Menu接受
CCMenuItemSprite
作为子菜单。 But xcode says: Cannot initialize a parameter of type CCNode*
with an lvalue of type SmartMenuItem*
. 但是xcode说:无法使用
SmartMenuItem*
类型的左值初始化CCNode*
类型的参数。
And also it gives warnings when i'm creating playItem
and optionsItem
: method not found. 当我创建
playItem
和optionsItem
时,它也发出警告:未找到方法。 But it is a static method of CCmenuItemSprite! 但这是CCmenuItemSprite的静态方法!
What's the problem ? 有什么问题 ?
Solved. 解决了。 The problem was in adding files to xcode project.
问题出在将文件添加到xcode项目中。 They were shared incorrectly.
他们被错误地共享。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.