Objective c 为什么CCLabelAlas[1]拒绝更新?
我在.h文件中声明了7个cclabelalas标签,如下所示Objective c 为什么CCLabelAlas[1]拒绝更新?,objective-c,cocos2d-iphone,Objective C,Cocos2d Iphone,我在.h文件中声明了7个cclabelalas标签,如下所示cclabelalas*numberStat[7]。然后我在.m文件中的for循环中初始化了它们: for (int i = 1; i <=7; i++) { NSString* statName = [NSString stringWithFormat @"Number %d", i]; numberStat[i] = [[CCLabelAtlas labelWithString: [self loadThisV
cclabelalas*numberStat[7]
。然后我在.m文件中的for循环中初始化了它们:
for (int i = 1; i <=7; i++) {
NSString* statName = [NSString stringWithFormat @"Number %d", i];
numberStat[i] = [[CCLabelAtlas labelWithString: [self loadThisValue:statName] charMapFile:@"digitalNumbers.png" itemWidth:26 itemHeight:37 startCharMap:'0'] retain];
[self addChild: numberStat[i]];
}
一种可能性是,在代码中的某个地方,numberStat[1]被过度释放,当您给它分配一个字符串时,一个CCSprite已经移动到它所占用的内存中。如何确保它不会被过度释放?我已经用
retain
声明了它。
-[CCSprite setString:]: unrecognized selector sent to instance 0x897cbd0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CCSprite setString:]: unrecognized selector sent to instance 0x897cbd0'