本文介绍了确定NSFetchedResultsController是否为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
确定NSFetchedResultsController是否为空(不包含任何条目)的好方法是什么?我意识到有人可以使用 fetchedObjects
是否会将所有结果加载到内存中?
What is a good way of determining if a NSFetchedResultsController is empty (contains no entries)? I realize that one could use fetchedObjects
does this load all results into memory?
推荐答案
fetchedObjects是一个数组,是检查0条记录的好方法。
fetchedObjects is an array, and is a good a way as any to check for 0 records.
您还可以使用
id <NSFetchedResultsSectionInfo> sectionInfo = [[_fetchedResultsController sections] objectAtIndex:section];
if([sectionInfo numberOfObjects] == 0)
{
// do something
}
这篇关于确定NSFetchedResultsController是否为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!