There are lots of apps where the searchbar moves upwards if active and moves down wh开发者_运维知识库en 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
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.
When the search bar becomes first responder it will animate itself. You can call [searchBar becomeFirstResponder]; or something like that, checkpoint the docs.
精彩评论