retain

Objective C, Memory Management

1) What is the reason for the use of retain? For example, in a setter method: - (void) setCount: (int) input { [intCount autorelease]; intCount = [input retain]; } 2) the autorelease-Method: Is it deleting an old object or preparing the new one? 3) Why the retain-method is called at the input-object? Would intCount = inpu...

question about retain attribute in properties.

Hi, The objective C docs say this about retain attribute in properties: "retain Specifies that retain should be invoked on the object upon assignment. (The default is assign.) The previous value is sent a release message." I thought I understood properties and attributes until I saw something like this in the UITableViewCell reference...

What happen when "retain" NSArray or NSMutableArray ?

In the source codes @property(retain) NSString* str; @sythesize str; self.str = newStr; I understand actually following will happen if( str != newStr ){ [str release]; str = [newStr retain]; } So how about the case for NSArray or NSMutableArray ? Seem like it is complex,shallow copy and deep copy should be considered. ...