Iphone hides UISearchDisplayController results?

Currently, I have UISearchBar and UISearchDisplayController implemented as:

- (void) viewDidLoad {

 videoList = [[NSMutableArray alloc]init];

 //Add the search bar
 aSearchBar = [[UISearchBar alloc] initWithFrame:CGRectZero];
    [aSearchBar sizeToFit];
 aSearchBar.delegate = self;
    aSearchBar.placeholder = @"Search YouTube...";

    self.tableView.tableHeaderView = aSearchBar;

    searchDC = [[UISearchDisplayController alloc] initWithSearchBar:aSearchBar contentsController:self];

    [self performSelector:@selector(setSearchDisplayController:) withObject:searchDC];

    searchDC.delegate = self;
    searchDC.searchResultsDataSource = self.tableView.dataSource;
    searchDC.searchResultsDelegate = self.tableView.delegate;

    [aSearchBar release];
    [searchDC release];

}

When a user enters something and searches, a column in the background is displayed at the top of the View table.

Are there any hides of this "searchResults tableView"? (I just want the background table to store the data that they currently do).

i.e. is there a property? e.g. searchDisplayController.tableView.visible = NO or similar?

+3
source share
3 answers

However, this does not cancel the search interface (the search bar and the "cancel" button). The following code does this:

    [self.searchDisplayController setActive:NO animated:YES];
+12
searchDC.searchResultsTableView.hidden=YES;
+2

[[UISearchBar alloc] initWithFrame: CGRectZero];

do not use CGRectZero self.searchBar = [[UISearchBar alloc] initWithFrame: CGRectMake (0, 0, self.table.frame.size.width, 44)];

try

0
source

Source: https://habr.com/ru/post/1763379/


All Articles