Not sure why this is causing me so much grief but, here it goes:
I want badges on all tableViewCells containing relational data.
The first view of my app uses a fetchedResultsController to populate tableViewCells with team names. I want the badge to show the number of athletes associated to each team.
I’m trying to pull the relationship to count it for each team in the viewWillAppear method.
I want to do something like:
Team *team = [fetchedResultsController objectAtIndexPath:indexPath];
NSString *counted = [team.athletes count];
But this does not work in ViewWillAppear because I don’t have a declared indexPath and am not sure how to do that. This has got to be one the simplest things to do but it throws me for a loop everytime I’m faced with it.
Any and all help is greatly appreciated!
You should do this in
tableView:cellForRowAtIndexPath:(or perhapsconfigureCell:forIndexPath:which is often used to combine a fetched results controller with a table view).Please note that
[team.athletes count]returns anint, not anNSString, so you probably want