You question may be a duplicate of How can I change strings of "Cancel" button, "No Results" label in UISearchBar of UISearchDisplayController?
Here's a modification of the answer given there:
-(BOOL)searchDisplayController:(UISearchDisplayController *)controller
shouldReloadTableForSearchString:(NSString *)searchString {
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, 0.001);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
for (UIView* v in self.sbc.searchResultsTableView.subviews) {
if ([v isKindOfClass: [UILabel class]] &&
[[(UILabel*)v text] isEqualToString:@"No Results"]) {
// .. do whatever you like to the UILabel here ..
break;
}
}
});
return YES;
}
Basically what you're asking to do is simply to access the UILabel that is displaying the "No Results" text. There is no official way to do that. The workaround, as suggested on that page, is to look for the UILabel (by enumerating all the subviews of the search results table) and modify it. I generally can't encourage this sort of thing, but I find Apple's refusal to supply an official way to grapple with this "No Results" label to be downright obnoxious, so no holds are barred in this particular fight.