3

is there a way I can have in the search results controller table view the exact same styling (height, background etc) I have in the prototype cell of my tableview controller in iOS5?

The root view has a background picture and a specific cell height. The search table does not appear with the background picture and the cell height is lower;

Tassos Voulgaris
  • 878
  • 1
  • 9
  • 21
  • 2
    Actually it was easy. Just use -(void)searchDisplayController:(UISearchDisplayController *)controller didLoadSearchResultsTableView:(UITableView *)tableView { and put styling code there – Tassos Voulgaris Mar 10 '12 at 21:36

1 Answers1

4

Another way is to just use the same cell identifier (at least if you're using storyboards), so for example:

    static NSString *CellIdentifier = @"searchCell";
myCustomCell *cell = (myCustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

//for search controller need to check if cell is nil, if it is create one since there won't be any to reuse to begin with
if (!cell) {
    cell = (myCustomCell *)[self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
}

Other properties such as row heights etc can be set by accessing properties of

self.searchDisplayController.searchResultsTableView 
SMSidat
  • 1,163
  • 1
  • 15
  • 34