I need to implement search history. so what i want to do is display the history in the search display controller when no text entered yet.
I implemented this:
-(void)searchDisplayControllerDidBeginSearch:(UISearchDisplayController *)controller{
self.searchDisplayController.searchResultsTableView.hidden=NO;
}
and also this:
- (void)searchDisplayController:(UISearchDisplayController *)controller didHideSearchResultsTableView:(UITableView *)tableView{
self.searchDisplayController.searchResultsTableView.hidden=NO;
}
to make the table be shown always.
I also implemented the number of rows to distinct the cases: (i also took care of cellForIndexpath
, but no need to show it here)
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if ([self.searchDisplayController.searchBar.text isEqualToString:@""]) {
NSArray* d=[DropsAppDelegate getSharedInstance].userData.getLastSearches;
return d.count;
}
return [searchResultPlaces count];
}
but this makes a mess. The table is shown but behind the half transparent screen and become visible when exiting the search.
and also that screen does not comes off when i actually type something.
what can i do to make the UITableView
always be shown?
I looked at all the answers but nothing works for iOS7.