例如:我做了这个数组来保留我所有的CCSprites:
CCSprite *Enemy[20];
我想没关系,因为我不会超过20个敌人,但现在我希望能够将它的大小增加到40个,一旦它充满了物体。
NSMutableArray *mySprites = [[NSMutableArray alloc] init];
// array is mutable so you can add to it
[mySprites addObject: newSprite];
// objective c syntax has improved, you can now access elements with the following syntax
CCSprite *mySprite = mySprites[0];