开发者

Search UISearchDisplayController w/ Scope Only

开发者 https://www.devze.com 2023-01-18 08:26 出处:网络
I am using UISearchDisplayController to pull in results from a webservice but I want to be able to search even if the search bar\'s text is empty. It seems like results are only be开发者_如何学Pythoni

I am using UISearchDisplayController to pull in results from a webservice but I want to be able to search even if the search bar's text is empty. It seems like results are only be开发者_如何学Pythoning pulled in if this is not empty. How do I update & show the results tableview by only scope?


Use the - (void)searchDisplayControllerDidBeginSearch:(UISearchDisplayController *)controller UISearchDisplayControllerDelegate to search and then reload the searchResultsTableView (UISearchDisplayController)


For that you can put the condition when the scope button is changed

if([searchBar.text length])
{
  //CALL FOR QUERY ACCORDING TO TEXT IN SEARCHBOX
}
else
{
  //CALL THE QUERY AS PER CHANGE IN SCOPE
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号