If you want to have the letters AZ on the side (even if you do not have partitions for each individual letter), this will do:
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView { return [NSArray arrayWithObjects:@"A",@"B",@"C",@"D",@"E",@"F",@"G",@"H",@"I",@"J",@"K",@"L",@"M",@"N",@"O",@"P",@"Q",@"R",@"S",@"T",@"U",@"V",@"W",@"X",@"Y",@"Z",@"#",nil]; } - (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index { index = 0; for(id sectionInfo in [_fetchedResultsController sections]){ if ([[[sectionInfo name] uppercaseString] isEqualToString:title]){ break; } index++; } if (index>=[_fetchedResultsController sections].count){ return -1; } return [_fetchedResultsController sectionForSectionIndexTitle:title atIndex:index]; }
source share