Re: RS: What's the difference?
Re: RS: What's the difference?
- Subject: Re: RS: What's the difference?
- From: Alastair Houghton <email@hidden>
- Date: Tue, 29 May 2007 18:02:15 +0100
On 28 May 2007, at 15:42, Shawn Erickson wrote:
On May 28, 2007, at 7:04 AM, Roland Silver wrote:
What's the difference between the two NSDictionary methods
valueForKey and objectForKey?
-[NSDictionary objectForKey:] is the primary way to fetch an object
from an NSDictionary.
-[NSDictionary valueForKey:] implements KVC support for
dictionaries (part of the NSKeyValueCoding informal protocol).
Perhaps the most important point (which I think probably is worth
stating here) is that -valueForKey: will work on non-NSDictionary
objects (provided they support KVO), whereas -objectForKey: generally
won't. It's also worth saying that -valueForKey:'s behaviour on the
collection objects is a little different to what you might naïvely
expect (though it's potentially very useful).
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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