• 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: Ondra Cada <email@hidden>
  • Date: Tue, 18 Apr 2006 23:58:41 +0200

Scott,

On 18.4.2006, at 23:38, Scott Ellsworth wrote:

I then call

[self setValue:newArray forKey:@"data.newElementAddedeEveryMinuteAtSecond5"]

This works. The array has been replaced by a new one, all the views get their notifications fired, and everyone is happy.

I am not pleased, though, that I am creating a brand new array every time through, when all I really want to do is to update the data by an item.

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.newElementAddedeEveryMinuteAtSecond5" ];
[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.
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

  • Follow-Ups:
    • Re: KVC on an array in an NSDictionary
      • From: Scott Ellsworth <email@hidden>
References: 
 >KVC on an array in an NSDictionary (From: Scott Ellsworth <email@hidden>)

  • Prev by Date: Re: Interface Builder Date Localization
  • Next by Date: Re: [Q] COM and dynamic link library?
  • Previous by thread: KVC on an array in an NSDictionary
  • Next by thread: Re: KVC on an array in an NSDictionary
  • Index(es):
    • Date
    • Thread