Quote:
Originally Posted by oohmyygoood
Interesting. It doesn't say in the Class Ref Library that buttonWithType returns an autorelease object.
Is this the case for other non-initWithXxxxxx methods that create and return objects as well? Such as [NSString stringWithString:] for instance?
I guess my question is if the rule is to only release objects that were created using an [.... alloc] init....] combo and all other methods return autorelease objects?
|
Yes. Unless the method has init or a copy in the name, assume it returns an autoreleased objects, or maybe a singleton or shared instance. Either way, if you did not init/copy/retain then you should not release.