how to add object multi NSArray in one NSMutableArray

ios, nsarray, nsmutablearray, objective-c

Solution

You can use addObjectsFromArray: from NSMutableArray class

all = [[NSMutableArray alloc]init];
[all addObjectsFromArray:animal];
[all addObjectsFromArray:color];

Problem

I want add object from 2 NSArray to NSMutableArray. I dont know about this. this my code: ``` @interface ViewController : UITableViewController { NSArray *animal; NSArray *color; NSMutableArray *all; } @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; animal = [[NSArray alloc]initWithObjects:@"Lion",@"Tiger",@"Dog",@"Cat",@"Sheep",@"Wolf", nil]; color = [[NSArray alloc]initWithObjects:@"Blue",@"Red",@"Yellow",@"Green",@"Black", nil]; all = ??? ; //how to add object from animal and color array in all } ```

Original source