我有一个表视图,它启用了部分索引。所有索引都正常显示,但是我无法获得实际响应的搜索图标。左侧的图片显示在使用右侧的部分索引滚动条后表格将滚动的高度,但它应显示右侧设计。任何帮助将不胜感激!!
答案 0 :(得分:1)
在这种情况下,我总是为搜索栏完成自定义滚动,并从委托方法返回-1。
我的tableView:sectionForSectionIndexTitle:atIndex:看起来像这样 - 不确定是否有更好的方法,但是:
- (NSInteger)tableView:(UITableView *)tv sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index {
NSInteger section = -1;
if ([title isEqualToString:UITableViewIndexSearch]) {
CGRect searchBarFrame = self.searchDisplayController.searchBar.frame;
[tv scrollRectToVisible:searchBarFrame animated:NO];
}
else {
section = whatever logic you use to determine section
}
return section;
}
BTW,这是使用searchDisplayController属性。