I am very shaky on what it is instance variables (or ivars) are meant to achieve when they are class names. I know this is a basic Objective-C principle, but I want to give it some relevancy when working with cocos2d.

For example in this interface:

@interface BulletCache : CCNode {

CCSpriteSheet* batch;
}

The CCSpriteSheet class (now updated to CCSpriteBatchNode, but this is an older v of the engine) has an instance that is an instance variable of BulletCache.

But what exactly does this mean? What does it allow BulletCache to do that it couldn't do before?

有帮助吗?

解决方案

After having talked to several programmers, it seems that instance variables consist of types and classes that this class owns--thus they are setup for autorelease in the dealloc method at the bottom of the class.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top