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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:54:49+00:00 2026-05-23T15:54:49+00:00

I’ve got a FRC with sections. I’ve implemented the section index (just like in

  • 0

I’ve got a FRC with sections. I’ve implemented the section index (just like in 6 other views where it works), and it shows; however, when I tap on one of the indexes it goes to the middle and stops. My FRC and sectionIndex methods are below.

I stepped through the code in the debugger, sectionForSectionIndexTitle returns the proper index (15 if it matters), but it just stops at “I”.

Any ideas?

- (NSFetchedResultsController *)fetchedResultsControllerWithPredicate:(NSPredicate *)aPredicate {

NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Categories" inManagedObjectContext:managedObjectContext];
[fetchRequest setEntity:entity];
//[fetchRequest setFetchBatchSize:20];

NSSortDescriptor *sortByName  = [[NSSortDescriptor alloc] initWithKey:@"Category" ascending:YES];
NSSortDescriptor *sortByPG = [[NSSortDescriptor alloc]initWithKey:@"ProductGroup" ascending:YES];
NSArray *sortDescriptors = [[NSArray alloc] initWithObjects: sortByName, sortByPG, nil];
[fetchRequest setSortDescriptors:sortDescriptors];
[sortByName release];
[sortByPG release];
[sortDescriptors release];
NSString *cacheName = nil; // @"Root";
if(!aPredicate){
    //aPredicate = [NSPredicate predicateWithFormat:@"Category <> %@", @"EQUIPMENT"];
}
[fetchRequest setPredicate:aPredicate];  
NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:managedObjectContext sectionNameKeyPath:@"Category" cacheName:cacheName];


aFetchedResultsController.delegate = self;

[fetchRequest release];

NSError *anyError = nil;


if(![aFetchedResultsController performFetch:&anyError]){
    NSLog(@"Error fetching: %@", anyError);
}
return [aFetchedResultsController autorelease];  

}

    - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
 {
NSMutableArray *sectionTitles = [[[NSMutableArray alloc] init] autorelease];
[sectionTitles addObject:UITableViewIndexSearch];
[sectionTitles addObjectsFromArray:[self.fetchedResultsController sectionIndexTitles]];
return sectionTitles;
//return [self.fetchedResultsController sectionIndexTitles];
}

-(NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index
{

if (index == 0) {
    [tableView setContentOffset:CGPointZero animated:NO];
    return NSNotFound;
}
//NSInteger indexToGoTo =  [self.fetchedResultsController sectionForSectionIndexTitle:title atIndex:index];

EDIT:

return index - 1; <-- This is wrong

//This is right!
return [self.fetchedResultsController sectionForSectionIndexTitle:title atIndex:index - 1]; 

}
  • 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-23T15:54:49+00:00Added an answer on May 23, 2026 at 3:54 pm

    D’oh! Well I hope this saves somebody else a couple of hours. . .

    in

    sectionForSectionIndexTitle
    

    instead of

    return index - 1;
    

    it should have been

    return [self.fetchedResultsController sectionForSectionIndexTitle:title atIndex:index - 1];
    

    I’m not sure why it works in the others, but I’m changing it in those as well.

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

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
i got an object with contents of html markup in it, for example: string
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I want to count how many characters a certain string has in PHP, but

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.