【问题标题】:SearchBar Display Controller not showing UITableViewCellAccessoryCheckmark on search resultSearchBar 显示控制器未在搜索结果中显示 UITableViewCellAccessoryCheckmark
【发布时间】:2015-01-15 19:34:39
【问题描述】:

我正在检查和取消选中表格视图单元格,但是我的代码在没有搜索显示控制器的情况下工作正常。当我使用搜索栏显示控制器时,我得到搜索结果,当我单击搜索结果详细信息“没有检查图标”和如果部分未调用“if (tableView == self.searchDisplayController.searchResultsTableView)”时,下面是我的代码..我无法附上我的源代码。

唯一的问题是,仅在单击搜索结果中的单元格时,我无法在单元格上添加复选图标。当我从搜索结果中删除文本时,我能够看到复选图标。请帮忙

提前致谢

【问题讨论】:

  • 您忘记在“以下是我的代码”下方发布您的代码
  • 我无法添加我的源代码,请有人帮助我。
  • 您可以通过将每行代码缩进四个空格来将代码放入问题文本中。这比屏幕截图更容易阅读,特别是如果您将其压缩为相关的代码片段。

标签: uisearchdisplaycontroller searchbar


【解决方案1】:

看起来在tableView:didSelectRowAtIndexPath 的末尾,您正在重新加载错误的表格视图。看到你写[self.tableView reloadData] 的地方了吗?尝试将其更改为

// At the end of tableView:didSelectRowAtIndexPath...
[tableView reloadData]  // Reload the tableView that was updated

或者,在 if 条件中检查是否是被选中的搜索表...

[self.searchDisplayController.searchResultsTableView reloadData];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-02-10
    • 2023-04-07
    • 1970-01-01
    • 2021-02-23
    • 2011-05-10
    • 2021-09-24
    • 1970-01-01
    相关资源
    最近更新 更多