• 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: KVC on an array in an NSDictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >KVC on an array in an NSDictionary (From: Scott Ellsworth <email@hidden>)
 >Re: KVC on an array in an NSDictionary (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: NSOpenPanel and field setting
  • Next by Date: Re: [Q] COM and dynamic link library?
  • Previous by thread: Re: KVC on an array in an NSDictionary
  • Next by thread: Animated Ripple Effect
  • Index(es):
    • Date
    • Thread