I have a Core Data model with an entity called SeasonInfo that contains a bunch of attributes, one of which is an attribute called year (int 16). SeasonInfo contains a one-to-many relationship to an entity called GameInfo (the relationship name defined in SeasonInfo is called games).
My populated database contains a bunch of seasons (one for every year)... then each season has a list of games - a bunch of games for each season. SeasonInfo <---->> GameInfo
In my TableView contoller I use the following to access the SeasonInfo for a given year :
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription
entityForName:@"SeasonInfo" inManagedObjectContext:managedObjectContext];
[fetchRequest setEntity:entity];
// Set up the cell...
SeasonInfo *info = [seasonInfoArray objectAtIndex:indexPath.row];
//Put the Year as the Main title of the Row
yearLabel.text =[NSString stringWithFormat: @"%@", info.year];
That seems to work great... but now I can't figure out how to access the games for a specific season. From this table view, when I select a specific year, I'd like to pass an NSArray of games to another Table View controller... I know how to pass data between views, I just can't figure out how to populate the "gamesArray" before I transition to the Schedule View.