1

I have a table view with a search bar. When I put some text in the search bar & search data I display different rows under different sections. I have enabled UIGestureRecognizer on the section header to collapse the rows. Once user tap on the section header I set the data objects to nil leading to number of rows returned for those sections as 0.

After the I call the following piece of code to refresh my search table view. It all works fine with exception that I can see "No Results" on the screen just below my collapsed sections. This works fine in non-search mode - collapsing the sections does not display "No Results" message there.

[self.searchController.searchResultsTableView reloadData];

I could see a private property _noResultsLabel & a _searchDisplayControllerFlags option as noResultsMessageAutoDisplay (set to 1) inside class UISearchDisplayController. Not able to reset them.

Any idea on this?

Abhinav
  • 37,684
  • 43
  • 191
  • 309
  • How about instead of removing the rows once a section is collapsed, you set their row-height to 0 in the table-view-delegate method. – Till Feb 07 '12 at 20:01
  • Nice thought. I tried but this is not helping. My cell height was 64 px which I now set to 0 but it looks to take default of 44 px. Then cellForRowAtIndexPath gets called and it sets values on my cell. So, my cell shrinks with some data visible on it. – Abhinav Feb 07 '12 at 22:05

0 Answers0