NCFUSN
NCFUSN

Reputation: 1644

iOS6, StoryBoards: UISearchDisplayController returns wrong custom UICell height

I use custom cells in storyboard with height set to 57.

enter image description here

While searching in tableView,UISearchDisplayController returns my custom cell but the height is wrong.

enter image description here

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

Answers (2)

Nagarjun
Nagarjun

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

adamweeks
adamweeks

Reputation: 1332

Have you tried setting the height of the search results cells in viewDidLoad with

self.searchDisplayController.searchResultsTableView.rowHeight = 100;

Upvotes: 2

Related Questions