Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UISearchDisplayController without a UITableView

Is it possible to implement a UISearchDisplayController without a UITableView? Or at least hide the TableView?

like image 404
Filipe Mota Avatar asked Apr 12 '26 10:04

Filipe Mota


1 Answers

Just create an instance of UISearchBar in your view and implement the UISearchBarDelegate protocol. Make sure your view is set as the delegate for the search bar as well. When the user clicks the done button it will send a message to the delegate method searchBarSearchButtonClicked:

- (void) viewDidLoad {
    [super viewDidLoad];
    self.searchBar.delegate = self;
}

- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
    // Handle search request
}

You just need to either place the UISearchBar in your nib file or place it programmatically.

like image 131
jerrylroberts Avatar answered Apr 15 '26 01:04

jerrylroberts



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!