Removing SectionIndex dynamically
I am using sectionIndexTit开发者_运维百科lesForTableView to display index in a UITableView. It is working fine but I am using the same TableView to display something where I do not need this index. So, the question is how to remove the sectionIndex?
Use a BOOL
value to track which display you are using (the first or the second) and do something like this (isDisplayingFirst
is a boolean):
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
{
if (isDisplayingFirst) {
// return your section index titles
}
return nil; // otherwise return nothing
}
精彩评论