【发布时间】:2011-09-13 21:04:23
【问题描述】:
我正在尝试创建一个UITableView 索引以更快地滚动大UITableView,我的索引显示在右侧,但是当我尝试使用它滚动时,它不起作用..
我想知道我是否错过了什么,所以我想知道我是否还有其他事情要做,或者类似的事情。
#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;
}
【问题讨论】:
标签: iphone ios uitableview indexing