Cómo dividir NSArray en secciones UITableView alfabéticamente

Tengo problemas para usar una tabla indexada con encabezados de sección. Actualmente tengo los índices en el lado derecho y tengo los encabezados de sección que se muestran correctamente, los encabezados solo se muestran si hay datos dentro de esa sección.

El problema que tengo es dividir el NSArray en partes para poder calcular el número de filas de filas correctamente. Actualmente tengo el número correcto de secciones que se muestran con los encabezados correctos, pero todos los datos están en cada sección, en lugar de dividirse según la primera letra del nombre.

Aquí hay una captura de pantalla de cómo se ve actualmente:

Todos los datos van a cada sección, 5 filas en cada una. El número de secciones (3) es correcto.

Mi código para esto es el siguiente:

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
    return [firstLetterArray objectAtIndex:section];
}

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

    NSMutableSet *mySet = [[NSMutableSet alloc] init];

    BRConnection *connection = nil;
    NSMutableArray *firstNames = [[NSMutableArray alloc] init];
    for (connection in _connections)
    {
        [firstNames addObject:connection.firstName];
    }
    firstNamesArray = firstNames;
    NSLog(@"%@", firstNamesArray);
    for ( NSString *s in firstNames)
    {
        if ([s length] > 0)
            [mySet addObject:[s substringToIndex:1]];
    }

    NSArray *indexArray = [[mySet allObjects] sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];

    firstLetterArray = indexArray;

    return [[UILocalizedIndexedCollation currentCollation] sectionIndexTitles];
}

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

    if ([title isEqualToString:@"{search}"])
    {
        [tableView setContentOffset:CGPointMake(0.0, -tableView.contentInset.top)];
        return [[UILocalizedIndexedCollation currentCollation] sectionForSectionIndexTitleAtIndex:index];
    }
    return [[UILocalizedIndexedCollation currentCollation] sectionForSectionIndexTitleAtIndex:index];
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"ConnectionCell"];

    // Display connection in the table cell
    BRConnection *connection = nil;
    if (tableView == self.searchDisplayController.searchResultsTableView) {
        connection = [searchResults objectAtIndex:indexPath.row];
    } else {
        connection = [_connections objectAtIndex:indexPath.row];
    }

    cell.textLabel.text = connection.fullName;
    cell.textLabel.font = [UIFont fontWithName:@"TitilliumText25L-400wt" size:18];
    cell.detailTextLabel.text = connection.company;
    cell.detailTextLabel.font = [UIFont fontWithName:@"TitilliumText25L-400wt" size:12];

    return cell;
}


- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    NSUInteger sections = [firstLetterArray count];
    return sections;

}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (tableView == self.searchDisplayController.searchResultsTableView) {
        return [searchResults count];

    } else {
        return [_connections count];
    }
}

Cualquier ayuda sería muy apreciada, parece que no puedo dividir las conexiones de NSArray en una lista alfabética para obtener las filas correctas en una sección. Gracias de antemano a todos!

Respuestas a la pregunta(3)

Su respuesta a la pregunta