NSFetchedResultsChangeUpdate

NSFetchedResultsChangeUpdate

本文介绍了如何知道为NSFetchedResultsChangeUpdate更改了哪个属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为有控制器的问题:didChangeObject:atIndexPath:forChangeType:newIndexPath:,特别是 NSFetchedResultsChangeUpdate :它不告诉你什么更改导致这个 NSFetchedResultsChangeUpdate

I thinks there is a problem of controller:didChangeObject:atIndexPath:forChangeType:newIndexPath:, specifically for NSFetchedResultsChangeUpdate: It does not tell you what change causes this NSFetchedResultsChangeUpdate.

我有一个非常复杂的实体。只有它的一部分数据用于填充我的表视图单元格。我不想更新我的单元格的任何不相关的属性更改 - 这是浪费资源。那么如何知道哪些属性更改导致此 NSFetchedResultsChangeUpdate ,以便我可以避免更新我的表视图单元格如果它是不相关的?

I have a very complex entity. Only a part of its data is are used to populate my table view cells. I don't want to update my cells for any irrelevant property changes — it is a waste of resources. So how can I know which property change causes this NSFetchedResultsChangeUpdate so that I can avoid updating my table view cells if it is irrelevant?

推荐答案

NSManagedObject 有两种方法。首先返回一个字典,其中包含自上次提取或保存对象以来已更改的键和(新)值(这是有效实现的,无需触发关系故障)

NSManagedObject have two methods for that. First returns a dictionary with the keys and (new) values that have been changed since last fetching or saving the object (this is implemented efficiently without firing relationship faults)

- (NSDictionary *)changedValues;

其次:

- (NSDictionary *)changedValuesForCurrentEvent NS_AVAILABLE(10_7, 5_0);

您通过 NSFetchedResultsController NSFetchedResultsChangeUpdate >

这篇关于如何知道为NSFetchedResultsChangeUpdate更改了哪个属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 02:40