hurley scott
hurley scott

Reputation: 11

iPhone UISearchBar animated to top

There are lots of apps where the searchbar moves upwards if active and moves down when it is inactive. There is a sample code from apple available which works with IB, but how can I achieve this behavior programmatically? Mostly it is combined with a navigationbar which moves out of the screen in replace with the searchbar

Upvotes: 1

Views: 1855

Answers (2)

Kinetic Stack
Kinetic Stack

Reputation: 798

Personally, I ended up using [self.navigationController setNavigationBarHidden:YES animated:YES]; when the search begins and then just do [self.navigationController setNavigationBarHidden:NO animated:YES]; once the search is done.

Upvotes: 3

fearmint
fearmint

Reputation: 5334

When the search bar becomes first responder it will animate itself. You can call [searchBar becomeFirstResponder]; or something like that, checkpoint the docs.

Upvotes: 1

Related Questions