Hi,developers…
I notice that the CCTableViewCell need autorelease like this (cpp testproject’s code )
CCTableViewCell *cell = table->dequeueCell();
if (!cell) {
cell = new CustomTableViewCell();
cell->autorelease();
CCSprite *sprite = CCSprite::create("Images/Icon.png");
sprite->setAnchorPoint(CCPointZero);
sprite->setPosition(ccp(0, 0));
cell->addChild(sprite);
}
however, I also notice that CCTableViewCell can’t call autorelease method in lua project, like this (lua testproject’s code )
local cell = table:dequeueCell()
local label = nil
if nil == cell then
cell = CCTableViewCell:new()
local sprite = CCSprite:create("Images/Icon.png")
sprite:setAnchorPoint(CCPointMake(0,0))
sprite:setPosition(CCPointMake(0, 0))
cell:addChild(sprite)
}
when I try to add the autorelease in lua ,cell:autorelease();, the game will crash ,
Do we need autorelease in lua ? why not ?
thank you for your answers…