【发布时间】:2014-10-07 12:27:51
【问题描述】:
我正在尝试创建一个简单的 CCNode 子类,但我无法创建对象。
它给了我错误“* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* +[ContentPane init]: cannot init a class object.'”
这是我的 CCNode 子类:
#import "ContentPane.h"
@implementation ContentPane{
int content[8][4];
CCSprite *_rockPath1;
CCSprite *_rockPath2;
}
- (id)init {
self = [super init];
if (self) {
CCLOG(@"ContentPane created");
}
return self;
}
@结束
这是我尝试启动它的地方:
- (void)didLoadFromCCB {
// tell this scene to accept touches
self.userInteractionEnabled = TRUE;
_counter = 0;
ContentPane *pane = [ContentPane init];
}
【问题讨论】:
标签: objective-c cocos2d-iphone subclass init