Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7400433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:14:58+00:00 2026-05-29T04:14:58+00:00

How do you navigate through arrays in Objective-C? Take the following example. ( [key]

  • 0

How do you navigate through arrays in Objective-C? Take the following example.

    (
        [key] => value
        [key] => value
    )

Any advice out there?

6 years later I realize how moronic this question is. I’m sorry Stack Overflow.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T04:14:59+00:00Added an answer on May 29, 2026 at 4:14 am

    “Navigate” is a rather ambiguous term, as it could mean “loop” or “index”. “Iterate” is a synonym for “loop”. Sometimes people use “dereference” for “index”, but dereferencing is properly applied only to pointers when accessing what is pointed to. In some languages, such as C, indexing involves dereferencing (which is why dereference is used in this way), but this isn’t true in general, and isn’t true of NSArrays in Objective-C.

    Arrays in Objective-C, as in most other languages, are only integer indexed. Dictionaries are the data structures that are indexed by strings; in Objective-C, dictionaries are available as NSDictionary and NSMutableDictionary. Dictionaries are also known as “associative arrays”, which often gets shortened to “arrays” when talking about PHP, since all arrays in PHP are associative.

    You index a dictionary with the objectForKey: method:

    NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
        [NSNumber numberWithDouble:120.50],@"balance",
        @"myuser",@"username"
        nil];
    
    NSLog(@"%@", [dict objectForKey:@"balance"]);
    NSLog(@"%@", [dict objectForKey:@"username"]);
    

    You can add an item to an NSMutableDictionary using setObject:forKey::

    // mutableDict is an owning reference; if not using ARC, it must be released
    NSMutableDictionary *mutableDict = [dict mutableCopyWithZone:NULL];
    [mutableDict setObject:@"bar" forKey:@"foo"];
    

    You can loop over keys with fast enumeration syntax:

    for (id key in dict) {
        NSLog(@"%@: %@", key, [dict objectForKey:key]);
    }
    

    Both iteration and indexing are the most basic array operations. If your current source for Objective-C information doesn’t discuss them, find a new source. If you don’t have a source, find one. You’ll never learn all that you need without one.

    See also:

    • Dictionary or Array
    • Is there a way to iterate over an dictionary?
    • Recover the value in an NSDictionary
    • BOOL issue in Objective-C
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any shortcuts available in XCode 4.2 to navigate through multiple open projects?
The following code gives a NullReferenceException since XPathSelectElement can't navigate through the XPath expression
in my jsp, when i navigate through tab key it skips my Save and
When i navigate through Tab key in my jsp. button in my page are
When I navigate through tab key in my web page submit button and some
When I navigate through my Website and access a new Site, by example: Default.aspx
I was wondering if there is some way in Vim to navigate through search
In my application you can navigate through several Activities until the Activity stack is
I have this menu structure that is used to navigate through content slider panels.
I usually use a TabControl and somehow hide the tabs and navigate through them.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.