I have read Apple's memory management guide on retain/release and
I think I've basically got it, but there's just one thing that
I'm not confident about and that is "setXXX" methods which accept an
NSObject parameter and I don't know how I can know whether the
"setXXX" retains or not.

For example:

I have installed a custom formatter for my NSTextField using

    [textField setFormatter:formatter];

Now, will "setFormatter" call retain on "formatter" or not? Looking
at "retainCount" seems to suggest so, although I know that this
isn't reliable and shouldn't be done at all...

So how can I find out if a certain method does a retain or not?
Sometimes, it's explicitly mentioned in the docs, e.g. in NSTableView
for "setDelegate" and "setDataSource" it's explicitly stated that
those methods don't retain. But other methods like "setFormatter"
don't mention anything. Does that mean that they retain then? 

Post-scriptum: Yes, I know, there's now ARC and everything and
all those retain stuff shouldn't be used anymore IIUC but I'm
still targetting 10.6 and my app only has a few lines of Objective C
anyway so it's not too bothering to work with retain.

-- 
Best regards,
 Andreas Falkenhahn                          mailto:andr...@falkenhahn.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to