Reputation: 1644
I use custom cells in storyboard with height set to 57.
While searching in tableView,UISearchDisplayController
returns my custom cell but the height is wrong.
Code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellReuseIdentifier = @"Cell";
CommemorativeItemCell *cell =[self.tableView dequeueReusableCellWithIdentifier:CellReuseIdentifier];
KmCell *kmCell=nil;
if(tableView==self.searchDisplayController.searchResultsTableView)
{
kmCell=[self.filteredResult objectAtIndex:[indexPath row]];
}
else
{
kmCell=[self.arr objectAtIndex:[indexPath row]];
}
// bla bla filling up and drawing labels...
return cell;
}
How to make the cells UISearchDisplayController returns to be of the same height? Thank you in advance.
Upvotes: 0
Views: 388
Reputation: 6867
Try this method this may help you!
You can return number as you want instead of 110. For example i am using 110.
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 110;
}
Upvotes: 1
Reputation: 1332
Have you tried setting the height of the search results cells in viewDidLoad with
self.searchDisplayController.searchResultsTableView.rowHeight = 100;
Upvotes: 2