Iphone 如何实现在tableView顶部添加索引搜索视图?

Iphone 如何实现在tableView顶部添加索引搜索视图?,iphone,Iphone,当触摸索引时,我想在UITableView顶部添加索引字母,如何操作 因为您已经有了可以在调用[self-setTitle:[sectionsArray objectAtIndex:indexPath.section]的willDisplayCell方法时实现的节 - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)i

当触摸索引时,我想在UITableView顶部添加索引字母,如何操作


因为您已经有了可以在调用[self-setTitle:[sectionsArray objectAtIndex:indexPath.section]的willDisplayCell方法时实现的节

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath
*)indexPath

找不到这方面的任何第三方实现,这令人惊讶(我很高兴被证明是错误的)。看起来您必须从头开始编写代码,将一个精简的UIView子类覆盖在表视图的顶部(可能最好在这里使用核心图形来绘制轮廓和字母),截取与之接触的内容并确定它们所接触的字母,然后使用向表视图发送适当的滚动指令

- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated