Non-alloc/copy Methods

Non-alloc/copy Methods 


+ (NSMutableString *)string

{ 

return [[[self alloc] init] autorelease]; 

} 

 

 

Let’s revisit why you don’t have to release objects from non-alloc or 

copy methods 


NSMutableString *theString = [NSMutableString string]; 


// You don’t have to release theString because you didn’t 

// alloc or copy it

你可能感兴趣的:(String,methods)