Skip to content

Instantly share code, notes, and snippets.

@FlaviuSim
Created March 28, 2012 15:03
Show Gist options
  • Save FlaviuSim/2226909 to your computer and use it in GitHub Desktop.
Save FlaviuSim/2226909 to your computer and use it in GitHub Desktop.
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
// get the table and search bar bounds
CGRect tableBounds = self.tableView.bounds;
CGRect searchBarFrame = self.searchBar.frame;
// make sure the search bar stays at the table's original x and y as the content moves
self.searchBar.frame = CGRectMake(tableBounds.origin.x,
tableBounds.origin.y,
searchBarFrame.size.width,
searchBarFrame.size.height
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment