Hi,
I have just come back to my Objective-C book, and something that I thought I had nailed a few weeks ago seems to have escaped my mind.
I know this is going to risk me sounding stupid, but I am going to go for it anyway.
Looking at NSArray objects as an example (and NSDictionary objects too), they both have methods such as
+(id)arrayWithCapacity size; or +(id)dictionaryWithObjectsAndKeys
-(id)initWithCapacity size; or -(id)initWithOjectsAndKeys
Could someone just explain to mean in simple English when the class method should be used, and when the instance method should be used.
I think it is related to what the created object is 'owned' by, and whether it needs manually releasing from memory, but i'm going round in circles and its doing my head in.
Hopefully some friendly passing MacRumors guru can sort me out once and for all. I plan to go through the book again from scratch hen I have covered most things, and pick up the stuff i missed.
Cheers
P.
I have just come back to my Objective-C book, and something that I thought I had nailed a few weeks ago seems to have escaped my mind.
I know this is going to risk me sounding stupid, but I am going to go for it anyway.
Looking at NSArray objects as an example (and NSDictionary objects too), they both have methods such as
+(id)arrayWithCapacity size; or +(id)dictionaryWithObjectsAndKeys
-(id)initWithCapacity size; or -(id)initWithOjectsAndKeys
Could someone just explain to mean in simple English when the class method should be used, and when the instance method should be used.
I think it is related to what the created object is 'owned' by, and whether it needs manually releasing from memory, but i'm going round in circles and its doing my head in.
Hopefully some friendly passing MacRumors guru can sort me out once and for all. I plan to go through the book again from scratch hen I have covered most things, and pick up the stuff i missed.
Cheers
P.