gpt4 book ai didi

iphone - 在 NSPredicate 更改后使用 NSFetchedResultsControllerDelegate 更新 TableView 部分和行

转载 作者:行者123 更新时间:2023-12-03 18:54:42 24 4
gpt4 key购买 nike

有没有办法在更改 fetchedResultsControllers NSpredicate (并执行提取)后更新 UITableView 部分和行?当我的 searchBar 中的 searchText 更改时,我想使用 controllerWillChangeContent 委托(delegate)方法来更新我的表。

目前在我的应用程序中,仅当核心数据发生更改时才会调用这些委托(delegate)方法。不是在更改 resultsController 谓词并执行获取时。

如果我只是在每次文本更改时调用 [self.tableView reloadData],则不会有动画,并且会有点阻碍体验。

或者我应该做一些完全不同的事情来更新每个搜索文本条目更改的 tableView 内容?

最佳答案

我再次查看了 Apple 的文档,看起来当谓词发生更改时,不会调用 NSFetchedResultsControllerDelegate 方法:

An instance of NSFetchedResultsController uses methods in this protocol to notify its delegate that the controller’s fetch results have been changed due to an add, remove, move, or update operations.

因此,回答我自己的问题:在 NSFetchedResultsController 谓词更改后,不可能使用 NSFetchedResultsControllerDelegate 来更新表。

关于iphone - 在 NSPredicate 更改后使用 NSFetchedResultsControllerDelegate 更新 TableView 部分和行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4574312/

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