UITableView 添加索引列

//添加索引列

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

{

if (tableView == self.searchDisplayController.searchResultsTableView)

{

    return nil;

}



return suoyinCityList;

}

//索引列点击事件

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

{

NSLog(@"===%@ ===%d",title,index);

//点击索引,列表跳转到对应索引的行

[tableView
scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:index+4]
atScrollPosition:UITableViewScrollPositionTop animated:YES];

//弹出首字母提示

//[self showLetter:title ];

return index+4;

}

你可能感兴趣的:(UITableView 添加索引列)