Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I determine if a UISearchDisplayController's searchResultsTableView is visible?

I have a UISearchDisplayController that is in the headerview for my UITableView. I want to know when the UISearchDisplayController's searchResultsTableView is shown so I can do some other operation:

if(self.tableView == self.searchDisplayController.searchResultsTableView)

returns true all the time even when the searchResultsTableView is shown. How can I figure this out?

like image 362
Sheehan Alam Avatar asked Aug 11 '11 23:08

Sheehan Alam


2 Answers

This should do the trick.

[self.searchDisplayController isActive]
like image 113
Mugunth Avatar answered Nov 15 '22 06:11

Mugunth


How about using the delegate methods for UISearchDisplayController?

searchDisplayController:willShowSearchResultsTableView:
searchDisplayController:didShowSearchResultsTableView:
searchDisplayController:willHideSearchResultsTableView:
searchDisplayController:didHideSearchResultsTableView:

Any reason these won't work for you?

like image 3
glorifiedHacker Avatar answered Nov 15 '22 06:11

glorifiedHacker