I’m struggling to show only 20 rows from NSFetchedResultsController in UITableView.
Currently UITableView shows all data from NSFetchedResultsController’s objects:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [[self.fetchedResultsController fetchedObjects] count];
}
What I’m trying to do is to show 20 rows at first, then when user scrolls to 21 row, it’ll load 20 more. But before that, I would like to understand how I can limit tableView rows.
I’ve searched around, tried suggestions by others, but still lacking understanding. Please guide me to the light…
NSFetchRequesthas a method calledfetchLimit. You can set it to 20 and it will only fetch 20.That being said, I’m not quite sure why you want what you described.