//创建可变数组
NSArray *arr3 = @[@"12",@"22",@"33"];
NSMutableArray *arr1 = [[NSMutableArray alloc] init];
NSMutableArray *arr2 = [[NSMutableArray alloc] initWithArray:arr3];
NSLog(@"arr1 = %@",arr1);
NSLog(@"arr2 = %@",arr2);
NSMutableArray *arr4 = [[NSMutableArray alloc] initWithObjects:@"123",@"we",@"1", nil];
NSLog(@"arr4 = %@",arr4);
//往数组末尾添加新的对象,一次添加一个
[arr4 addObject:@"haha"];
NSLog(@"newarr4 = %@",arr4);
//往数组末尾添加多个对象
NSArray *arr5 = @[@"123",@"ha",@"1"];
[arr4 addObjectsFromArray:arr5];
NSLog(@"new2arr4 = %@",arr4);
//往数组的中间某个指定位置(按索引/下标添加)
[arr4 insertObject:@"doubi" atIndex:3];
NSLog(@"new3arr4 = %@",arr4);
//删除单个对象,如果对象相同,本例对象@“123”相同,则都删除
[arr4 removeObject:@"123"];
NSLog(@"new4arr4 = %@",arr4);
//删除指定范围的对象
[arr4 removeObject:@"1" inRange:NSMakeRange(0, 4)];
NSLog(@"new5arr4 = %@",arr4);
//删除索引/下标对应的对象
[arr4 removeObjectAtIndex:2];
NSLog(@"new6arr4 = %@",arr4);
//删除数组最后一个对象
[arr4 removeLastObject];
NSLog(@"new7arr4 = %@",arr4);
//删除数组中所有对象
[arr4 removeAllObjects];
NSLog(@"new8arr4 = %@",arr4);
//交换数组中索引对应的对象
NSArray *arr6 = @[@"1",@"2",@"3",@"4",@"5",@"6"];
NSMutableArray *arr7 =[[NSMutableArray alloc] initWithArray:arr6];
[arr7 exchangeObjectAtIndex:1 withObjectAtIndex:2];
NSLog(@"arr7 = %@",arr7);
//替换指定的索引的对象
[arr7 replaceObjectAtIndex:2 withObject:@"7"];
NSLog(@"new1arr7 = %@",arr7);
//重置数组
NSArray *arr8 = @[@"1",@"2",@"3",@"4",@"5",@"6"];
[arr7 setArray:arr8];
NSLog(@"new2arr7 = %@",arr7);