我有3张桌子。第一个显示七个工作日,第二个显示连接到当天的数组中的内容,最后一个是具有不同字符串的列表,我希望能够点击,然后添加到上一个选定日期阵列。
mondayArray = [[NSMutableArray alloc] init];
tuesdayArray = [[NSMutableArray alloc] init];
wedensdayArray = [[NSMutableArray alloc] init];
thursdayArray = [[NSMutableArray alloc] init];
fridayArray = [[NSMutableArray alloc] init];
saturdayArray = [[NSMutableArray alloc] init];
sundayArray = [[NSMutableArray alloc] init];
// Sætter ugedage op
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];
在另一个实现文件(InfoTable)中,我使用数组来创建表:
cell.textLabel.text = [dayList objectAtIndex:indexPath.row];
然后在最后一个实现文件中,我尝试在didSelectRowAtIndexPath添加到该数组:
InfoTable *appDelegate = (InfoTable *)[[UIApplication sharedApplication] delegate];
NSString *temp;
// Gives me the item from the list i clicked
temp = [dagListe objectAtIndex:indexPath.row];
// Tries to add the above 'temp' to the array.
[appDelegate.dayList addObject:temp];
我似乎无法找到错误,当我运行它时,我得到:
-[VisueltSkemaAppDelegate dayList]: unrecognized selector sent to instance 0x58241d0
答案 0 :(得分:0)
错误似乎是appDelegate.dayList
。它告诉您它在您的应用程序委托中找不到名为dayList
的属性。你为它添加了一个属性,还是只是一个实例变量?
当你建造时,这是否显示为警告?编译器应该已经抓住了这个。注意(并修复!)编译器警告总是一个好主意。只是因为Xcode让你无视它们并运行你的应用程序,并不意味着你应该。 :)
答案 1 :(得分:0)
您是否已将@synthesize添加到标题中声明的属性的实现文件中?