当然在UITableView中还有关于索引的相关属性设置如下:
_myTableView.sectionIndexColor = [UIColorblueColor];//设置默认时索引值颜色
_myTableView.sectionIndexTrackingBackgroundColor = [UIColorgrayColor];//设置选中时,索引背景颜色
_myTableView.sectionIndexBackgroundColor = [UIColorclearColor];// 设置默认时,索引的背景颜色
//添加索引列
-(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;
}