Re: Doesn't -sortedArrayUsingDescriptors: use KVC accessors?
Re: Doesn't -sortedArrayUsingDescriptors: use KVC accessors?
- Subject: Re: Doesn't -sortedArrayUsingDescriptors: use KVC accessors?
- From: Jerry Krinock <email@hidden>
- Date: Wed, 22 Mar 2006 13:41:05 -0800
- Thread-topic: Doesn't -sortedArrayUsingDescriptors: use KVC accessors?
I got an off-list response from A.T. which explained the solution, and it is
documented that NSDictionary -valueForKey will use -objectForKey unless I
prefix my key name with "@".
Strange, but works as stated. Problem solved!
on 06/03/21 22:13, Fritz Anderson at email@hidden wrote:
> Without prejudice to the question of whether adding key-value accessors to an
> abstract class will work for purposes of the Key-Value Coding protocol...
It might, but it won't work for other reasons.
> Why don't you have a class that includes an NSMutableDictionary as an instance
> variable? It would allow you to change the underlying data structure of your
> class without having to change all the code that uses the class. You can
> probably use the code you already wrote for your accessors, with small
> changes.
Thanks, I'll consider that the next time I consider converting my category
to a class (which I do every few months).
on 06/03/21 23:49, Greg Herlihy at email@hidden wrote:
> Did you remember to provide both the get and the "set" accessor method for
> each attribute? KVO ignores a get accessor method unless a corresponding
> "set" accessor method is also implemented (note that the "set" method merely
> has to exist, and can in fact do nothing).
I had them in 2 out of 3 of my "accessors", but after adding the "@" prefix,
I found that this was not necessary.
_______________________________________________
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