Reputation: 75
I am trying to use the count of objects from my FRC fetch so that I can create an "Add" cell after all of my fetched objects have been listed in a UITableView. Is there a method for returning the number of objects fetched? I can only find a method that returns the count of sections for a given FRC.
Upvotes: 0
Views: 112
Reputation: 64428
Simplistically, you You want a count of fetchedObjects
. So:
[[myFRC fetchedObjects] count];
The problem that you're going to have with adding an additional cell, is that every time the table ask for the count of sections and rows, you're going to have add 1 to the count so the table knows to add the extra row.
Bjarne Mogstad is correct. It's quicker and cleaner to put the add element in a header or footer for the table itself. That way, the table directly and cleanly represents the data structure without having to constantly adjust for the phantom row.
Upvotes: 2
Reputation: 1154
The easiest way to do this is by setting the tableFooterView property of your table view. The footer view will be displayed below the last table view cell.
Upvotes: 1