@property and assign, retain, copy
From The Objective-C 2.0 Programming Language here is how assign retain and copy will be effectively implemented by @synthesize and how they should be functionally implemented by you if not synthesized.
property = newValue;
// retain
if (property != newValue)
{
[property release];
property = [newValue retain];
}
// copy
if (property != newValue)
{
[property release];
property = [newValue copy];
}
property = newValue;
// retain
if (property != newValue)
{
[property release];
property = [newValue retain];
}
// copy
if (property != newValue)
{
[property release];
property = [newValue copy];
}
Labels: Cocoa, iPhone, Objective-C, UIKit


0 Comments:
Post a Comment
<< Home