ios - What does retain as property attribute exactly do in objective-c? -
if declare public property :
@property (retain) nsstring * name;
then how compiler implicitly implement this? have read retain gains ownership on instance variable "_name". have read "retain" message increases reference count of object. each time call setter "name" property in above example, increase reference count?
so after this,
object.name=@"name1"; object.name=@"name2";
will reference count 2?
according @blamdarot- "retain" needed when attribute pointer object. setter generated @synthesize retain (aka add retain count) object. need release object when finished it.
Comments
Post a Comment