Overriding -searchResultsTableView
won't work, because UISearchDisplayController
accesses its table view instance variable directly, without calling the method.
The designated initializer for UISearchDisplayController
appears to be a private method, -initWithSearchBar:contentsController:searchResultsTableViewStyle:
, which sets the _searchResultsTableViewStyle
instance variable. This instance variable is used in creating the search results table view. The public initializer calls this method, passing UITableViewStylePlain
.
Directly calling the private designated initializer or setting the instance variable would likely get an application rejected from the App Store, so you might instead try overriding the public initializer and calling
[self setValue:[NSNumber numberWithInt:UITableViewStyleGrouped]
forKey:@"searchResultsTableViewStyle"];