UITableView in iPhone app - how to get number of rows

objective-c, uitableview

Solution

You should really get this from the source of the data, rather than the table view itself, I'd have thought. (It's a bit arse about face as they'd say around here.)

That said, you could use the `numberOfRowsInSection:` method within the UITableView as you've shown in your example.

Problem

How can i store the number of current rows in a uitable into a variable? This is my code for the table (that i think might be relevant): ``` - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:section]; return [sectionInfo numberOfObjects]; ``` }

Original source