I would suggest having one NSFetchedResultsController
and keep the data live. Then have a state array for the sections to know whether they are open or closed. From there you can answer the "number of rows" question by first checking state and then if the state is open asking the NSFetchedResultsController
how many items are actually in that section and replying with the answer.
When the user taps on a section you can then tell the table to add the cells via animation, etc. and remove them on a close. No reason to fetch each section individually or repeatedly.