I couldn’t get variableHeightRows to work on a search view controller.
TTTableViewController* searchController = [[TTTableViewController alloc] init];
searchController.dataSource = [[[SomeDataSource alloc] init] autorelease];
searchController.variableHeightRows = YES; // this doesn't affect the table
self.searchViewController = searchController;
[searchController release];
self.tableView.tableHeaderView = _searchController.searchBar;
_searchController.pausesBeforeSearching = YES;
[_searchController setSearchResultsDelegate:self];
It always show the rows in the default height. On my regular table view with the same datasource, the height of the rows is set to the custom one I supply in + (CGFloat)tableView:(UITableView*)tableView rowHeightForObject:(id)object, but specifically not on the search controller.
Am I doing it wrong?
After deep investigation…
I set the delegate of the search controller to the same class (
[_searchController setSearchResultsDelegate:self];), something which prevented from a TTTableViewVarHeightDelegate delegate to be created, therefore, the custom heightForRowAtIndexPath wasn’t called. I added:to the TTTableViewController class (source of TTTableViewVarHeightDelegate) and it worked.