开发者

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

开发者 https://www.devze.com 2023-03-27 07:06 出处:网络
I have a UISearchDisplayController that is in the headerview for my UITableView. I want to know when the UISe开发者_运维百科archDisplayController\'s searchResultsTableView is shown so I can do some ot

I have a UISearchDisplayController that is in the headerview for my UITableView. I want to know when the UISe开发者_运维百科archDisplayController'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?


This should do the trick.

[self.searchDisplayController isActive]


How about using the delegate methods for UISearchDisplayController?

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

Any reason these won't work for you?

0

精彩评论

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

关注公众号