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!
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";
}
}
}
}
It's an old thread, but for anyone having the same issue, try something like this.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (tableView == _searchDisplayController.searchResultsTableView) {
if (_searchResults.count == 0) {
for (UIView *view in tableView.subviews) {
if ([view isKindOfClass:[UILabel class]]) {
((UILabel *)view).text = @"YOUR_TEXT";
}
}
}
return _searchResults.count;
} else {
return (_items.count == 0) ? 0 : _items.count;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With