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

The Archive Base Latest Questions

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

All, I have about 3000 words with definitions that I am loading into a

  • 0

All,

I have about 3000 words with definitions that I am loading into a TableView. Right now, it’s just a sorted list of words, sans the sections because I haven’t added them yet.

Table View without Sections

I need to add sections to my TableView data (A,B,C …) and there seems to be several ways to do this so before I jump into this I am looking for some confirmation or correction if I am going down the wrong rabbit hole.

Currently the data that the TableView reads is stored as objects in an NSMutableArray per this code:

//AppDelegate.m
- (void)applicationDidFinishLaunching:(UIApplication *)application
{

 //...

NSMutableArray *wordArray = [[NSMutableArray alloc] init];

//Loop through result set from DB and populate objects
while([rs next]){


       [wordArray addObject:[Word wordWith:[rs stringForColumn:@"word"]
                                 Definition:[rs stringForColumn:@"definition"] 
                               SectionIndex:[rs stringForColumn:@"sectionIndex"]]];



   }
   MainViewController *mainViewController = 
   [[MainViewController alloc] initWithNibName:@"MainView" bundle:nil];

   mainViewController.listContent = wordArray;

   //...

 }

Each object has a section index value ([A-Z0-9]) so I already know which section each word goes in, I know what the sections need to be and I can easily derive a count of objects for each section. All the words have been sorted via SQL before the NSMutableArray was populated so that’s already handled.

Can I create multiple sections with the one NSMutableArray or do I need to do something different?

Thanks

  • 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-29T06:58:46+00:00Added an answer on May 29, 2026 at 6:58 am

    You could store your words into arrays inside a NSDictionary holding keys for each letter.

    Number of sections would return

    [[dictionary allKeys] count];
    

    Title for section

    NSArray * keys = [dictionary allKeys];
    [keys objectAtIndex:sectionIdx]
    

    Number of rows in section would return

    NSArray * keys = [dictionary allKeys];
    [(NSArray *)[dictionary objectForKey:[keys objectAtIndex:sectionIdx]] count];
    

    Each word would be

    NSArray * keys = [dictionary allKeys];
    [(NSArray *)[dictionary objectForKey:[keys objectAtIndex:sectionIdx]] objectAtIndex:indexPath.row];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been wondering about temp tables in sp's and how all that can
I have seen posts all over the internet that talk about how to fix
First of all, I have to say that I'm going to talk about System.ComponentModel.Component
Hey all, I'm about to rip my hair out. I have this client that
I have a public facing hobby site that gets about 3000 unique visitors a
hi all i have a question about hiding records in crystal report and i
At my house I have about 10 computers all different processors and speeds (all
I've got about 200k images in a bucket. They all have expires headers of
I have used all the Standard Network related code for Getting Images of about
Dear all, I have a question about Facebook Page: ( NOT user profile page,

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.