I was wondering is there any way to implement such UI features. As we know when we dragged in a search bar and searchDisplay control in xcode 5, we are be given a set of search controls including a search bar and a searchDisplayController.
Instead of using the native search bar, I want to use a button to trigger the search display control like that one in the latest facebook app.
I have tried to delete the search bar. But the display control failed directly. I have tried to insert the search bar inside the tableView (Which I don't know its correct or not)
- (void)viewDidLoad
{
[self hideSearchBar];
}
- (void)hideSearchBar
{
self.UISearchBar.hidden = YES;
self.UISearchBar.bounds = CGRectMake(0, 0, 0, 0);
}
- (IBAction)SearchClicked:(UIButton *)sender {
[self.searchDisplayController setActive:YES animated:NO];
self.UISearchBar.hidden = NO;
}
- (void) searchDisplayControllerWillEndSearch:(UISearchDisplayController *)controller
{
[self hideSearchBar];
}
But the problem with it is:
When I cancel the search the scroll view is not return to its previous state. (There is a gap space where the hidden searchBar sits).
Instead of seeing this:
I want to see this when the cancel button is clicked in the search view.
How can I address this issue?
Can any body provide me with a better solution?
Thanks