Search code examples
iosuitableviewuisearchbaruisearchdisplaycontroller

how to change the text "no results" when search in tableview?


After search in UITableView with no result, I want to change the text "No results" to "Not Match...".But I can't find where.Please help!

enter image description here

Here is some code:

- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar{
 if ([self.webSearchData count] == 0) {

            for (UILabel *label in self.searchTable.subviews) {
                if (label.text = @"No Results") {
                    label.text = @"Not Match";
                }
            }
}
}

Solution

  • Create a custom view with a label having text "No Results" and load it whenever your search query contain no value.