How to add action for UITableView index event - for each alphabet letter
I have alphabet strip (index), like in Apple's Contacts app, showing in a UITableView
but now I want to add an act开发者_JAVA技巧ion for each and every letter when I touch them?
Take a look at UITableViewDataSource protocol.
You'll easily know which letter was touched.
Take advantage of the fact that the tableView is a scrollView and that your <UITableViewDelegate>
will also conform to <UIScrollViewDelegate>
and use the -scrollViewDidScroll:
method:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if(![scrollView isDragging] && ![scrollView isDecelerating]) {
NSLog(@"User scrolled using tableView index");
}
}
Best,
精彩评论