views:

276

answers:

2

I'm trying to read the cocos2d api doc but I'm confused about what the [...] means in something like:

- (float) scale [read,write,assign]

I am expecting a type and a parameter name, so something like

- (void) addFrameWithFilename: (NSString *) filename

makes sense.

+2  A: 

It's a description of a property (and those are separated out as such in the docs you linked to). Those are property attributes in the []; in this case they are indicating the existence of two methods, a getter (read) and setter (write):

- (float)scale
- (void)setScale:(float)value
smorgan
+2  A: 

Those are Objective-C 2.0 properties. There is a good tutorial on the topic.

Basically, if you have an instance foo, you can access and modify the property by doing something like:

foo.scale = 3.0f;
Daniel Dickison