Skip to content

Instantly share code, notes, and snippets.

@astralbodies
Created August 1, 2012 12:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astralbodies/3226628 to your computer and use it in GitHub Desktop.
Save astralbodies/3226628 to your computer and use it in GitHub Desktop.
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