【问题标题】:Accessing Algolia InstantSearch hits before tableView cellForRow containingHit method在 tableView cellForRow 包含Hit 方法之前访问 Algolia InstantSearch 命中
【发布时间】:2018-03-27 17:20:00
【问题描述】:

是否可以在此
HitsCollectionViewDataSource 方法之前访问来自InstantSearch 查询的命中?

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath, containing hit: [String : Any]) -> UITableViewCell 

我想在HitsTableWidget 中显示之前过滤掉某些匹配。

【问题讨论】:

    标签: ios swift algolia instantsearch


    【解决方案1】:

    如果您想对点击进行更多自定义,您将不得不做更多的管道工作,并且无法使用HitsCollectionViewDataSource

    您应该使用InstantSearch.shared.searcher 提供的方法,特别是:InstantSearch.shared.searcher.addResultHandler(_:),这将帮助您指定每次新结果到达时都会调用的闭包。您需要做的是使用这些搜索结果,过滤掉您想要的匹配,然后手动重新加载CollectionView

    有关更多信息,请查看我们的指南 here 使用 InstantSearchCore。如果您有任何反馈或更多问题,请不要犹豫!

    【讨论】:

      猜你喜欢
      • 2021-09-02
      • 2016-11-10
      • 1970-01-01
      • 1970-01-01
      • 2019-01-06
      • 2018-10-23
      • 1970-01-01
      • 2015-05-25
      • 2018-04-01
      相关资源
      最近更新 更多