在某个Layer中,有一个array,里面放了多个batchnode,其中,每一个batchnode都放了几个sprite, 在update函数中动态遍历每个sprite,然后要动态删除添加array里面的batchnode,但在remove batchnode时出现问题了!就在this->remove(temp_batchnode)这句出问题
void Layer::update(float t)
{
one_frame_timer++;
for (int i=0; i< array_normal_star_batchnode->count(); i++)
{
CCSpriteBatchNode * temp_batchnode = (CCSpriteBatchNode *)array_normal_star_batchnode->objectAtIndex(i);
CCArray * temp_array = temp_batchnode->getChildren();
int temp_batchnode_count = 0;
for(int j=0;j< temp_array->count();j++)
{
StarNormal * temp_sprite = (StarNormal *)temp_array->objectAtIndex(j);
if(one_frame_timer >= temp_sprite->end_frame)
{
temp_sprite -> setVisible(false);
temp_batchnode_count++;
}
}
if( temp_batchnode_count == temp_array->count())
{
array_normal_star_batchnode->removeObjectAtIndex(i);
this->removechild(temp_batchnode);
}
}
}
```
这是怎么一回事哇?很简单的一个remove啊,是不是不能用temp这种形式的? 求教大家了!

