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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:00:50+00:00 2026-05-26T17:00:50+00:00

I have implemented a Section Index for my tableview. It returns the correct letters

  • 0

I have implemented a Section Index for my tableview. It returns the correct letters for what is stored in coredata (A B C D F G H I K M N O P Q R S T U V W). However the indexes are off.

If I click on the letter M it takes me to letter I, etc.. The name of the index I am attempting to sort on is name

What is there for me to do to fix the index?

I am also implementing numberOfSectionsInTableView,numberOfRowsInSection, and titeForHeaderInSection. The section headers are displayed correctly.

- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {

    NSArray * sectionTitlesArray = [fetchedResultsController sectionIndexTitles];
    NSMutableArray *newTitles = [[NSMutableArray alloc] init];
    for (NSString *state in sectionTitlesArray) {
        [newTitles addObject:[NSString stringWithFormat:@"%@", state]];
    }
    return [newTitles autorelease];
}

Including the FRC just in case it is relevant:

- (NSFetchedResultsController *)fetchedResultsController {
    if (fetchedResultsController == nil) {
        NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
        NSEntityDescription *entity = [NSEntityDescription entityForName:@"WidgetCoItems" inManagedObjectContext:managedObjectContext];
        [fetchRequest setEntity:entity];

        NSSortDescriptor *sortDescriptor1 = [[NSSortDescriptor alloc] initWithKey:@"state" ascending:YES];

        NSSortDescriptor *sortDescriptor2 = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES];

        NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor1,sortDescriptor2, nil];

        [fetchRequest setSortDescriptors:sortDescriptors];

        NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:managedObjectContext sectionNameKeyPath:@"state" cacheName:nil];
        aFetchedResultsController.delegate = self;
        self.fetchedResultsController = aFetchedResultsController;

        [aFetchedResultsController release];
        [fetchRequest release];
        [sortDescriptor1 release];
        [sortDescriptor2 release];
        [sortDescriptors release];
    }   
    return fetchedResultsController;
}  
  • 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-26T17:00:51+00:00Added an answer on May 26, 2026 at 5:00 pm
    - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView 
    {
            NSMutableArray *indices = [NSMutableArray array];
    
            id <NSFetchedResultsSectionInfo> sectionInfo;
    
            for( sectionInfo in [fetchedResultsController sections] )
            {
                [indices addObject:[sectionInfo name]];
            }
            return indices;
    }
    
    - (NSString *)tableView:(UITableView *)aTableView titleForHeaderInSection:(NSInteger)section
    {
        return [[[fetchedResultsController sections] objectAtIndex:section] name];
    }
    

    Try to implement in this way.

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

Sidebar

Related Questions

I have implemented Section Indexer for an Adapter class which extends BaseAdapter. Now for
I have a stored procedure that, depending on the input, returns multiple rows of
I have implemented the A* algorithm in AS3 and it works great except for
I have implemented Facebook Connect into a HTML page exactly as the tutorial explains
I have implemented a VSS requester, and it links compiles and executes on Windows
I have implemented a ToString() override method for my class in my Webservice and
I have implemented a sort of Repository class and it has has GetByID ,
I have implemented a DAL using Rob Conery's spin on the repository pattern (from
I have implemented a printer delivery extension based on MS example in SSRS 2005.
I have implemented a custom ActionMapper which obtains the locale from the URI (the

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.