【发布时间】:2011-05-04 13:36:18
【问题描述】:
请我尝试将两个 NSArray 的内容放在两个 NSMutableArray 中,但它似乎不起作用:
NSMutableArray *newArrayTypeCarburant = [[NSMutableArray alloc]init];
NSMutableArray *newArrayNomStation = [[NSMutableArray alloc]init];
for(int i=0; i <[topStation.listeTypesDesCarburants count]; i++)
{
[newArrayTypeCarburant addObjectsFromArray: [topStation.listeTypesDesCarburants objectAtIndex:i]];
}
for(int i=0; i <[topStation.listeDesEnseignes count]; i++)
{
[newArrayNomStation addObjectsFromArray: [topStation.listeDesEnseignes objectAtIndex:i]];
}
topStation.listeDesEnseignes 和 topStation.listeTypesDesCarburants 是在 appdelegate 类中声明的两个 NSArray 和全局变量。请帮助,谢谢提前))
编辑 我试试看:
NSMutableArray *newArrayTypeCarburant = [[NSMutableArray alloc]init];
NSMutableArray *newArrayNomStation = [[NSMutableArray alloc]init];
for(int i=0; i <[topStation.listeTypesDesCarburants count]; i++)
{
[newArrayTypeCarburant addObject: [topStation.listeTypesDesCarburants objectAtIndex:i]];
}
for(int i=0; i <[topStation.listeDesEnseignes count]; i++)
{
[newArrayNomStation addObject: [topStation.listeDesEnseignes objectAtIndex:i]];
}
self.pickerArrayTypeCarburant = newArrayTypeCarburant;
self.pickerArrayNomStation = newArrayNomStation;
第一个选择器包含数组中的值,但是当我尝试单击第二个选择器时,抛出异常:
2011-05-04 15:10:06.631[1065:207] -[__NSCFDictionary isEqualToString:]: unrecognized selector sent to instance 0x6e389a0
2011-05-04 15:10:06.633[1065:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary isEqualToString:]: unrecognized selector sent to instance 0x6e389a0'
【问题讨论】:
标签: ios nsmutablearray nsarray