确定NSFetchedResultsController是否为空

编程入门 行业动态 更新时间:2024-10-21 10:27:46
本文介绍了确定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是否为空

本文发布于:2023-11-29 17:16:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1647066.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:为空   NSFetchedResultsController

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!