• 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: allKeys and allValues
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: allKeys and allValues


  • Subject: Re: allKeys and allValues
  • From: Nick Zitzmann <email@hidden>
  • Date: Mon, 4 Oct 2010 15:30:48 -0600

On Oct 4, 2010, at 3:21 PM, gMail.com wrote:

> On the docs I read that for both the NSDictionary's allKeys and allValues,
> the order of the elements in the array is not defined. Ok.
> But, are the two arrays aligned each other?
>
> I mean, I have a dictionary containing several entries whose key is, e.g.
> @"0", @"3", @"42",...
> I show these entries on a tableView picking the dict from the rowIndex.
>    aDict = [[dicts allValues] objectAtIndex:row];
> It works. But now, If I delete a row, using the rowIndex, I should do
>
> NSString *ID = [[dicts allKeys] objectAtIndex:row];
> [dicts removeObjectForKey:ID];
>
> Is that correct?
> Is it assured that the n key of the allKeys array always corresponds to the
> n value in the allValues array?

If that works, it's an implementation detail, and I wouldn't rely on that behavior because it could change at any time. You should use an array of dictionaries in a table view, not an enumerated dictionary.

Nick Zitzmann
<http://www.chronosnet.com/>

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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

References: 
 >allKeys and allValues (From: "gMail.com" <email@hidden>)

  • Prev by Date: allKeys and allValues
  • Next by Date: Re: allKeys and allValues
  • Previous by thread: allKeys and allValues
  • Next by thread: Re: allKeys and allValues
  • Index(es):
    • Date
    • Thread