[英]UITableView tapping index doesnt scroll to section
我有一個tableView,其中實現了節標題,並且節標題出現在右側。 但是,當我點擊索引時,即使我在日志中看到它返回了正確的部分,它也不會滾動到該部分。
這是我的tableView:sectionForSectionIndexTitles:atIndex方法
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index {
NSLog(@"Title: %@", title);
NSLog(@"index: %d", index);
return [[UILocalizedIndexedCollation currentCollation] sectionForSectionIndexTitleAtIndex:index];
}
任何幫助將是巨大的,謝謝。
如果要創建字母,請滾動。 這會有所幫助。
-(void)viewDidLoad {
//section index in tableview
alphabetsArray = [[NSArray alloc] initWithObjects:@"#",@"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];
}
-(NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
{
return alphabetsArray;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.