I made a data.plist and want to load the root array (names) into a table view, then when you click on each cell, it will load their corresponding exercise array into a new table view. How would I implement this method into my TableViewController?
My current plist has a root array, with a dictionary item for each muscle group (Item 0, then child name) then contains an array for the muscle’s exercises.
My didSelectRowAtIndexPath Method for the first table that pushes the 2nd view subtable is:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
ExerciseTableViewController *detailViewController = [[ExerciseTableViewController alloc] initWithNibName:@"AbdominalTableViewController" bundle:nil];
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
My viewDidLoad method for the 2nd table view controller (this needs to be fixed) is:
- (void)viewDidLoad
if (exerciseArray == nil)
{
NSString *path = [[NSBundle mainBundle]pathForResource:@"biceps" ofType:@"plist"];
NSMutableArray *array = [[NSMutableArray alloc]initWithContentsOfFile:path];
self.exerciseArray = array;
[array release];
Assuming i understand you question.
You can do something like:
And in the second controller:
Hope it’s help.
Edit after Faisal comment:
Using the following plist file:

For read this plist you can do:
Then for read the second level, the ‘rootLevel’ content: