Skip to content

Instantly share code, notes, and snippets.

@nomatteus
Created March 13, 2013 01:16
Show Gist options
  • Save nomatteus/5148606 to your computer and use it in GitHub Desktop.
Save nomatteus/5148606 to your computer and use it in GitHub Desktop.
Code to animate a search bar out of view after a few seconds.
// ANIMATE SEARCH BAR AWAY
// This code is in a table view class.
// Idea was to show the search bar, to let the user know it exists, then animate it away after a couple seconds.
// This code works great, but I took the feature out, and just showed the search bar persistently.
- (void)setupSearchBar {
// Hide search bar after a couple seconds, to let user know it's there.
[self performSelector:@selector(animateHideSearchBar) withObject:nil afterDelay:2.5];
}
- (void)animateHideSearchBar {
// Scroll table view so search bar is just out of sight
CGPoint offset = CGPointMake(0, self.searchBar.frame.size.height);
[self.tableView setContentOffset:offset animated:YES];
}
@phpmaps
Copy link

phpmaps commented Mar 13, 2013

Paul I was just looking at some code of your on a site (involving CSS), then I posted to myself a CURL Gist and now see you again here, having just posted a Gist.

It's a very small world.

@phpmaps
Copy link

phpmaps commented Mar 13, 2013

Sorry clicked the wrong comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment