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 6589457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:10:40+00:00 2026-05-25T17:10:40+00:00

I am trying to set up my uitableview for indexing, I have got number

  • 0

I am trying to set up my uitableview for indexing, I have got number of sections working fine, now and the data is in the NSDictionary heres my output with nslog —>

Dictionary: {
    H =     (
        Honda,
        Honda,
        Honda,
        Honda,
        Honda,
        Honda,
        Honda
    );
    M =     (
        Mazda,
        Mazda,
        Mitsubishi,
        Mitsubishi,
        Mitsubishi,
        Mitsubishi,
        Mitsubishi,
        Mitsubishi
    );
    N =     (
        Nissan,
        Nissan,
        Nissan,
        Nissan,
        Nissan,
        Nissan,
        Nissan
    );
    T =     (
        Toyota,
        Toyota,
        Toyota
    );

I am now trying to set up my table like so

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    return [arraysByLetter count];
    //return 0;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    return [[arraysByLetter objectAtIndex:section] count];
    //return 1;
}

however I am getting a warning ‘NSMutableDictionary’ may not respond to ‘objectAtIndex:’ inside my numberOfRowsInSection delegate method… How do I get around this?

  • 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-25T17:10:40+00:00Added an answer on May 25, 2026 at 5:10 pm

    You cannot index a dictionary as you would an array. You access dictionaries using keys. NSDictionary does provide two methods for getting arrays: allKeys and allValues.

    I’m not sure what you are trying to accomplish, but if you want to organize the car makers alphabetically, you can get all the keys ([arraysByLetter allKeys]), sort them alphabetically, and then index into that sorted array. When you actually get the car makers’ names you will then use objectForKey: to load the array of makers.

    Update:
    Assuming a sorted array named sortedLetters, you can change your numberOfRowsInSection to the following:

    NSString *currentLetter = [sortedLetters objectAtIndex:section];
    return [[arraysByLetter objectForKey:currentLetter] count];
    

    You probably want to setup the sortedLetters array on initialization, unless it is dynamic.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to set up a UITableView which acts as a form. Each cell
I am trying to set up an object to control all of my data
I'm trying to create a UITableView to allow the user to enter data, similar
I have a UITableView cell and I need to set it's label to Sometext
I'm trying to add two extra rows to my UITableView. Data comes from the
I have a UIViewController that contains a UITableView. I'm trying to fill this table
I have a UITableView I'm populating with data from CoreData. I have a data
I have a problem with UITableView , particularly with scrollToRowAtIndexPath . Here we set
I'm trying to set up a simple UITableView with a UISearchDisplayDelegate but my app
I'm trying to set the color of the selected row in a UITableView, using

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.