So I have a tableView that has sections and rows, and it uses a custom cell class. The custom cell has an image view and a few labels. The table view works fine, and the sea
My summary for UITableView with Search Bar and Search Display using same custom cell designed in storyboard protype:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"CellIdentifierAsYouDefinedInStoryboard";
CustomTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[CustomTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
if (tableView == self.searchDisplayController.searchResultsTableView) {
/* searchResultsTableView code here */
} else {
/* Base tableView table code here */
}
/* more cell code here */
return cell;
}
and then add this line for searchResultsTableView to match your custom cell height:
- (void)viewDidLoad
{
[super viewDidLoad];
[self.searchDisplayController.searchResultsTableView setRowHeight:self.tableView.rowHeight];
/* more of your viewDidLoad code */
}