How to add an NSMutableArray to an NSMutableArray Objective-c

后端 未结 5 1081
[愿得一人]
[愿得一人] 2021-02-12 13:50

I am making the switch from Java to Objective-c, and I\'m having some difficulty. I have searched this problem this without much success.

I have an NSMutableArray that

5条回答
  •  悲&欢浪女
    2021-02-12 14:22

    In case if you add the same NSMutableArray Object, Like

    NSMutableArray *mutableArray1 = [[NSMutableArray alloc]initWithObjects:@"test1",@"test2",@"test3",nil];
    
    NSMutableArray *mutableArray2 = [[NSMutableArray alloc]initWithObjects:@"test4",@"test5",@"test6", nil];
    
    mutableArray1 = [NSMutableArray arrayWithArray:mutableArray1];
    
    [mutableArray1 addObjectsFromArray:mutableArray2]; 
    
    Nslog(@"mutableArray1 : %@",mutableArray1);
    

提交回复
热议问题