Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Scroll to the search bar when tapping the magnifying glass
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index
{
if (index == 0) {
CGRect searchBarFrame = self.searchDisplayController.searchBar.frame;
[tableView scrollRectToVisible:searchBarFrame animated:NO];
return -1;
}
return index;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment