1

Actually my TableView's background color is really black. However when i use SearchBar and search words,if there is no data that match , there will appear "NO Result" UITableView with White Color. I don't want to appear that White color background with " NO Result " TableViewCell if there are no match words.. How can i remove that White UITableViewCell?

That No Result TableView is i want to remove if there are no result that match. enter image description here

jscs
  • 63,694
  • 13
  • 151
  • 195
Fire Fist
  • 7,032
  • 12
  • 63
  • 109
  • 1
    Would be helpful to see your code so far... – SomaMan Apr 16 '12 at 17:58
  • 1
    Take a look at those two related questions: http://stackoverflow.com/questions/3451945/uitableview-change-no-results-message and http://stackoverflow.com/questions/1165224/searchdisplaycontroller-change-the-label-no-results – MByD Apr 16 '12 at 18:32

1 Answers1

2

That tableView comes automatic since it's part of the search, however you can modify by doing this:

  1. Create a boolean flag named noResultsToDisplay (or something else).
  2. If you have no results to display then set noResultsToDisplay = YES, set it to NO otherwise.
  3. In numberOfRowsInSection, if (noResultsToDisplay) return 3;
  4. In cellForRowAtIndexPath, if (noResultsToDisplay && indexPath.row == 2) cell.textLabel.text = @"No Results";