开发者_JS百科I use a UISearchDisplayController
and I search a way to disable the automatic search.
Is there a way for that?
Implement the UISearchDisplayControllerDelegate method -searchDisplayController:shouldReloadTableForSearchScope:
and return NO
. When you want to reload the search table, call [theSearchDisplayController.searchResultsTableView reloadData]
.
To disable the automatic search in UISearchDisplayController
1) set UISearchDisplayDelegate to self
2) in didShowSearchResultsTableView delegate method
set the frame searchResultsTableView as
CGRect tempFrame= searchDisplayController.searchResultsTableView.frame;
tempFrame.size.height=0.0f;
searchDisplayController.searchResultsTableView.frame=tempFrame;
Here is your answer, which has a nice explanation of how this works. I thought about giving you the answer in a single line but I wanted to let you know more details so you can get a better idea of how it works?
精彩评论