UITableView controller with prototype custom Cell and Search TableView controllers

is there a way I can have in the search results table of the search results exactly the same style (height, background, etc.) I have in the prototype cell of my table controller in iOS5?

The root view has a background image and a specific cell height. The lookup table is not displayed with a background image and the cell height is lower;


source to share

1 answer

Another way is to use the same cell ID (at least if you are using storyboards), 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 like line heights etc. can be set by accessing properties





All Articles