gpt4 book ai didi

ios - 自定义搜索结果 TableView

转载 作者:行者123 更新时间:2023-12-01 17:21:41 24 4
gpt4 key购买 nike

我正在寻找定制 UITableViewCells对于我的UISearchDisplayController . searchResultsTableView是一个只读属性。我有用于返回自定义单元格的 searchviewcontroller 的委托(delegate)和数据源,但是,它似乎仍在使用 searchResultsTableView细胞。使用我自己的 UITableViewCells 获得搜索结果的最佳方式是什么? ?

最佳答案

当搜索开始时,会创建一个全新的 UITableView。这个新的表格 View 将使用默认设置,并且与您的表格 View 不匹配。在您的 UISearchDisplayDelegate 中,覆盖 searchDisplayControllerWillBeginSearch: 以重新设置新 UITableView 的主题,如下所示:

- (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller {
// Re-style the search controller's table view
UITableView *tableView = controller.searchResultsTableView;
tableView.backgroundColor = [UIColor blueColor];
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
}

关于ios - 自定义搜索结果 TableView ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7681647/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com