Ios 将数组作为对象添加到另一个数组
我想将数组作为对象添加到另一个数组中。。 这就是为什么我要这么做:Ios 将数组作为对象添加到另一个数组,ios,ios7,nsmutablearray,nsarray,Ios,Ios7,Nsmutablearray,Nsarray,我想将数组作为对象添加到另一个数组中。。 这就是为什么我要这么做: -(void)compute:(NSMutableArray *)ary completion:(void (^)(void))completion{ int id=0; NSLog(@"Array is%@",ary); NSArray *temp; for(int i=0;i<[ary count];i++){ temp=[ary objectAtIndex:i];
-(void)compute:(NSMutableArray *)ary completion:(void (^)(void))completion{
int id=0;
NSLog(@"Array is%@",ary);
NSArray *temp;
for(int i=0;i<[ary count];i++){
temp=[ary objectAtIndex:i];
id=[[temp objectAtIndex:4] integerValue];
NSLog(@"temp is%@ %d",temp,id);
// [MyAppDelegate.searchResultArray addobject:temp];
}
NSLog(@"%@",MyAppDelegate.searchResultArray);
}
-(void)计算:(NSMutableArray*)元补全:(void(^)(void))补全{
int id=0;
NSLog(@“数组为%@”,ary);
NSArray*温度;
对于(inti=0;i试试这个
-(void)compute:(NSMutableArray *)ary completion:(void (^)(void))completion{
int id=0;
NSLog(@"Array is%@",ary);
NSMutableArray *temp;
for(int i=0;i<[ary count];i++){
temp=[ary objectAtIndex:i];
NSLog(@"string%@",[temp objectAtIndex:8]);
if(id==[[temp objectAtIndex:4] integerValue]){
NSLog(@"inside");
NSMutableArray *temp1=[[NSMutableArray alloc]init];
temp1=[MyAppDelegate.searchResultArray objectAtIndex:i-1];
NSLog(@"temp1%@",temp1);
NSString *tempStr=[[temp1 objectAtIndex:8] stringByAppendingString:[temp objectAtIndex:8]];
NSLog(@"%@",tempStr);
[temp1 replaceObjectAtIndex:8 withObject:tempStr];
[MyAppDelegate.searchResultArray replaceObjectAtIndex:i-1 withObject:temp1];
}
else{
id=[[temp objectAtIndex:4] integerValue];
NSLog(@"temp is%@ %d",temp,id);
[MyAppDelegate.searchResultArray addObject:temp];
}
}
NSLog(@"%@",MyAppDelegate.searchResultArray);
}
-(void)计算:(NSMutableArray*)元补全:(void(^)(void))补全{
int id=0;
NSLog(@“数组为%@”,ary);
NSMutableArray*温度;
对于(int i=0;i