I am trying to create a UITableView
index for faster scrolling of a large UITableView
, I have the index showing up on the right but when I try to scroll with it, it does not work..
I am wondering if I have missed something so I am wondering if there is something else I have to do, or something along those lines.
#pragma - TableView Index Scrolling
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
if(searching)
return nil;
NSMutableArray *tempArray = [[NSMutableArray alloc] init];
[tempArray addObject:@"A"];
[tempArray addObject:@"B"];
[tempArray addObject:@"C"];
[tempArray addObject:@"D"];
[tempArray addObject:@"E"];
[tempArray addObject:@"F"];
[tempArray addObject:@"G"];
[tempArray addObject:@"H"];
[tempArray addObject:@"I"];
[tempArray addObject:@"J"];
[tempArray addObject:@"K"];
[tempArray addObject:@"L"];
[tempArray addObject:@"M"];
[tempArray addObject:@"N"];
[tempArray addObject:@"O"];
[tempArray addObject:@"P"];
[tempArray addObject:@"Q"];
[tempArray addObject:@"R"];
[tempArray addObject:@"S"];
[tempArray addObject:@"T"];
[tempArray addObject:@"U"];
[tempArray addObject:@"V"];
[tempArray addObject:@"W"];
[tempArray addObject:@"Y"];
[tempArray addObject:@"X"];
[tempArray addObject:@"Z"];
return tempArray;
}
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index {
if(searching)
return -1;
return index % 2;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…