Does setFormatter() retain?
Does setFormatter() retain?
- Subject: Does setFormatter() retain?
- From: Andreas Falkenhahn <email@hidden>
- Date: Wed, 24 Aug 2016 22:04:05 +0200
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:email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden