Fire Fist
Fire Fist

Reputation: 7060

How to remove No Result TableView of UITableViewCell in iOS?

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

Upvotes: 1

Views: 1866

Answers (1)

user2742371
user2742371

Reputation:

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";

Upvotes: 2

Related Questions