Tassos Voulgaris
Tassos Voulgaris

Reputation: 888

UITableView Controller with prototype custom cell and search display controller tableview

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;

Upvotes: 3

Views: 2797

Answers (1)

SMSidat
SMSidat

Reputation: 1183

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 

Upvotes: 4

Related Questions