d'abord toutes les sections Définir
self.sections = [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];
puis
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 27;
}
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
{
return self.sections;
}
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString*)title atIndex:(NSInteger)index
{
return index;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
return [self.sections objectAtIndex:section];
}
Après ce filtre par alphabets
NSArray *sectionArray = [vendorList filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF beginswith[c] %@", [self.sections objectAtIndex:section]]];
rowCount = [sectionArray count];
Je n'ai pas trouvé un moyen d'activer le groupage automatique. Je l'ai donc implémenté moi-même en passant par les tableaux et en construisant de nouveaux basés sur les premières lettres de ses entrées. – flohei
Pourriez-vous poster votre solution? Cela rendrait plus clair que ce problème a été résolu. En outre, s'il obtient trois upvotes, vous obtiendrez un badge d'auto-apprenant pour votre problème. –
Oh cool. Oui, je l'afficherai demain. – flohei