Re: KVC on an array in an NSDictionary
Re: KVC on an array in an NSDictionary
- Subject: Re: KVC on an array in an NSDictionary
- From: Scott Ellsworth <email@hidden>
- Date: Tue, 18 Apr 2006 15:14:30 -0700
On Apr 18, 2006, at 2:58 PM, Ondra Cada wrote:
Scott,
Is there a KVC-compliant way to remove element zero and add a new
element at the end of an NSMutableArray that will keep KVB/O
notifications working?
The proper solution should be
id ma=[self
mutableArrayValueForKeyPath:@"data.newElementAddedeEveryMinuteAtSecond
5"];
[ma addObject:newElement];
[ma removeObjectAtIndex:0];
Is there a catch that if the array lays inside an
NSMutableDictionary it does not work properly? I haven't tried
myself. But it should
The suggested method works fine with an NSMutableDictionary, and now
all my strip charts are updating happily.
I had missed mutableArrayValueForKeyPath in the docs. Surprising,
since I use mutableSetValueForKey all the time in Core Data apps. No
accounting, I suppose, for search keys you do not think of.
I did file a doc bug, suggesting a note be added to the KVC
programming guide in the 'setting values' section.
Thanks much, Ondra
Scott
_______________________________________________
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