• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Does setFormatter() retain?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Does setFormatter() retain?
      • From: Wim Lewis <email@hidden>
    • Re: Does setFormatter() retain?
      • From: Jens Alfke <email@hidden>
    • Re: Does setFormatter() retain?
      • From: Ben Kennedy <email@hidden>
  • Prev by Date: Re: Core Graphics: Is it better to up-sample or down-sample images when drawing into a rect?
  • Next by Date: Re: Does setFormatter() retain?
  • Previous by thread: Re: Core Graphics: Is it better to up-sample or down-sample images when drawing into a rect?
  • Next by thread: Re: Does setFormatter() retain?
  • Index(es):
    • Date
    • Thread