本文介绍了确定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是否为空
发布评论