Re: Is it a "Value" or an "Object" ?
Re: Is it a "Value" or an "Object" ?
- Subject: Re: Is it a "Value" or an "Object" ?
- From: Keary Suska <email@hidden>
- Date: Sat, 21 Mar 2009 09:47:27 -0600
On Mar 21, 2009, at 7:57 AM, Jerry Krinock wrote:
On 2009 Mar 21, at 06:46, Luca C. wrote:
Essentially they are the same, but the word "value" fits nicely
with KVC.
Yes, but "setObject" is usually used for dictionaries, although
there is the variant -setValue:forKey: which handles nil objects,
unlike -setObject:forKey: which raises an exception.
Is there a method to the madness?
-setValue:forKey: is not a variant of -setObject:forKey:. -
setObject:forKey: is the method for setting the object for a specific
key in an NSMutabelDictionary. -setValue:forKey: is a method declared
by the NSKeyValueCoding informal protocol implemented in NSObject that
sets a property value for any NSObject subclass. There is not likely
anything more special in the naming use than that.
In fact, the docs for NSMutableDictionary's setValue:forKey: say:
"This method adds value and key to the receiver using
setObject:forKey:, unless value is nil in which case the method
instead attempts to remove key using removeObjectForKey:."
Best,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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