On Sep 6, 2011, at 9:30 AM, Torsten Curdt wrote:
> So what should one use e.g. for normal IBOutlets with AppKit?
The answer is in the 2010-12-21 revision of the Memory Management Programming
Guide.
It seems to be missing however from the current 2011-03-24 revision of this
document.
Here is the quote from the older revision.
====================
Memory Management Programming Guide, Memory Management of Nib Objects
When a nib file is loaded and outlets established, the nib-loading mechanism
always uses accessor methods if they are present (on both Mac OS X and iOS).
Therefore, whichever platform you develop for, you should typically declare
outlets using the Objective-C declared properties feature.
The general form of the declaration should be:
@property (attributes) IBOutlet UserInterfaceElementClass *anOutlet;
The behavior of outlets depends on the platform (see “Mac OS X” (page 47) and
“iOS” (page 48)), so the actual declaration differs:
● For Mac OS X, you should use:
@property (assign) IBOutlet UserInterfaceElementClass *anOutlet;
● For iOS, you should use:
@property (nonatomic, retain) IBOutlet UIUserInterfaceElementClass
*anOutlet;
You should then either synthesize the corresponding accessor methods, or
implement them according to the declaration, and (in iOS) release the
corresponding variable in dealloc.
This pattern also works if you use the modern runtime and synthesize the
instance variables, so it remains consistent across all situations.
====================
--Richard
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]