I’ve got a data structure like this in a loop, the content of the produced array called self.practice should be populate a dynamic tableview in tableviewController
// new NSDictionary
NSDictionary *highway = [[NSDictionary alloc] initWithObjectsAndKeys:@"Highway", @"description",
@"H", @"namekey",
[NSString stringWithFormat:@"%i", aHours], @"hours",
aHoursDefault.stringValue, @"hoursdefault",
[self.classlist objectAtIndex:i], @"driverclass",
nil];
NSDictionary *freeway = [[NSDictionary alloc] initWithObjectsAndKeys:@"Freeway", @"description",
@"F", @"namekey",
[NSString stringWithFormat:@"%i", fHours], @"hours",
fHoursDefault.stringValue, @"hoursdefault",
[self.classlist objectAtIndex:i], @"driverclass",
nil];
NSDictionary *stateHigway = [[NSDictionary alloc] initWithObjectsAndKeys:@"stateHighway", @"description",
@"S", @"namekey",
[NSString stringWithFormat:@"%i", sHours], @"hours",
sHoursDefault.stringValue, @"hoursdefault",
[self.classlist objectAtIndex:i], @"driverclass",
nil];
// Values of Dictionary assign to array
[self.practiceOverviewData addObject:highway];
[self.practiceOverviewData addObject:freeway];
[self.practiceOverviewData addObject:stateHighway];
// put those arrays in the "Big Array" for my tableview
[self.practice addObject:self.practiceOverviewData];
Now in my cellForRowAtIndexPath: I cant access the key values from the inner arrays via
cell.textLabel.text = [[self.practice objectAtIndex:indexPath.row] objectForKey:@"description"];
your
self.practicecontains array, which is thepracticeOverviewDataand yourpracticeOverviewDatacontains dictionary:access the data like this:
EDIT:
in cellForRowAtIndexPath:..
EDIT: this code assumes your
self.practicemight contain different kind of data.