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;

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容