Unsure how i load the right data into a tableview, chosen from a previous tableview.
Posted
by
Bob
on Stack Overflow
See other posts from Stack Overflow
or by Bob
Published on 2011-03-12T23:55:19Z
Indexed on
2011/03/13
0:10 UTC
Read the original article
Hit count: 138
I currently have two TableViewControllers. The first has seven objects, each day-name listed.
Weekdays *mandag = [[Weekdays alloc] initWithName:@"Mandag" daylist:mondayArray];
Weekdays *tirsdag = [[Weekdays alloc] initWithName:@"Tirsdag" daylist:tuesdayArray];
Weekdays *onsdag = [[Weekdays alloc] initWithName:@"Onsdag" daylist:wedensdayArray];
Weekdays *torsdag = [[Weekdays alloc] initWithName:@"Torsdag" daylist:thursdayArray];
Weekdays *fredag = [[Weekdays alloc] initWithName:@"Fredag" daylist:fridayArray];
Weekdays *lordag = [[Weekdays alloc] initWithName:@"Lørdag" daylist:saturdayArray];
Weekdays *sondag = [[Weekdays alloc] initWithName:@"Søndag" daylist:sundayArray];
daylist being a NSMutableArray. The idea is: The name of the day is displayed on table-1. And the array (daylist) of each day is displayed on table-2 - when tabbed one a day. The first table, displaying the names is working fine:
VisueltSkemaAppDelegate *appDelegate = (VisueltSkemaAppDelegate *)[[UIApplication sharedApplication] delegate];
Weekdays *ugeDag = (Weekdays *)[appDelegate.ugeDage objectAtIndex:indexPath.row];
cell.textLabel.text = ugeDag.name;
return cell;
However i thought i could do the same, for the second table - but i have been strugling with it for hours now. This is what i got:
VisueltSkemaAppDelegate *appDelegate = (VisueltSkemaAppDelegate *)[[UIApplication sharedApplication] delegate];
Weekdays *ugeDag = (Weekdays *)[appDelegate.ugeDage objectAtIndex:indexPath.row];
cell.textLabel.text = [ugeDag.daylist objectAtIndex:indexPath.row];
return cell;
Abit more of the code: http://pastebin.com/iW5AAJXt
© Stack Overflow or respective owner