I want to customize "No Results" string in UISearchDisplayController
. In documentation you can find that UISearchDisplayController
has property searchResultsTitle
that as I thought should change this string, but it doesn't work.
Please help with customization "No Results" string in iOS 5 and above. And why searchResultsTitle
doesn't work?
The searchResultsTitle
property of UISearchDisplayController
does not actually controls the No Results text. If you look at the instance variables of UISearchDisplayController
you will see both _resultsTitle
and _noResultsMessage
. The _noResultsMessage
is what controls the No Results text but has unfortunately no public property.
You can nevertheless set a custom message with this code using the undocumented instance variable:
@try
{
[self.searchDisplayController setValue:@"No Results, try again later." forKey:[@[@"no", @"Results", @"Message"] componentsJoinedByString:@""]];
}
@catch (NSException *exception) {}
As for searchResultsTitle
, the documentation is so scarce that I have no idea what it controls!