• 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
Re: setValue vs setObject (NSMutableDictionary)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: setValue vs setObject (NSMutableDictionary)


  • Subject: Re: setValue vs setObject (NSMutableDictionary)
  • From: Sherm Pendley <email@hidden>
  • Date: Sun, 17 Apr 2005 20:58:19 -0400

On Apr 17, 2005, at 8:36 PM, Mark Dawson wrote:

Why would you expect that to work? -setValue:forKey: is clearly documented as taking an id for value.

The difference is that setValue is KVC compliant, whereas setObject was not.


Sorry about that. I could have sworn that I saw something that referenced it could be a scalar (which is why I asked the question), but all I see now is the (id) reference. SIgh.

There are certain types of conversions that happen automagically when you use KVC with a scalar instance variable. If you call - setValue:forKey in that case, you can pass an NSNumber or NSValue object as the value. The value will be converted to the correct type when that's possible.


So yeah, there *is* some magic going on, in that you can have a scalar instance variable and still use KVC methods to work with it. But you still need to pass objects to the KVC methods.

sherm--


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >setValue vs setObject (NSMutableDictionary) (From: Mark Dawson <email@hidden>)
 >Re: setValue vs setObject (NSMutableDictionary) (From: Sherm Pendley <email@hidden>)
 >Re: setValue vs setObject (NSMutableDictionary) (From: Mark Dawson <email@hidden>)

  • Prev by Date: indeterminate progress bar animation problem
  • Next by Date: Re: #define issues
  • Previous by thread: Re: setValue vs setObject (NSMutableDictionary)
  • Next by thread: Displaying an AWT Image on an NSButton
  • Index(es):
    • Date
    • Thread