Three20:searchViewController 上的variableHeightRows
我无法让variableHeightRows 在搜索视图控制器上工作。
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];
它始终以默认高度显示行。在具有相同数据源的常规表视图上,行高设置为我在 + (CGFloat)tableView:(UITableView*)tableView rowHeightForObject:(id)object 中提供的自定义高度,但是特别是不在搜索控制器上。
我做错了吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过深入调查...
我将搜索控制器的委托设置为同一个类(
[_searchController setSearchResultsDelegate:self];
),这阻止了创建 TTTableViewVarHeightDelegate 委托,因此,自定义heightForRowAtIndexPath 未被调用。我添加:到 TTTableViewController 类(TTTableViewVarHeightDelegate 的来源)并且它起作用了。
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.