//1.使用实例方法创建
NSMutableArray *array3 = [[NSMutableArray alloc]initWithObjects:@"123", @"222", @"321", @"333", nil];
NSLog(@"%@",array3);
//2.使用类方法创建
NSMutableArray *array4 = [NSMutableArray arrayWithObjects:@"789", @"888", @"999", @"987", nil];
NSLog(@"%@",array4);
//3.添加元素
[array3 addObject:@"asdf"];
NSLog(@"%@", array3);
//4.插入元素
[array4 insertObject:@"zzz" atIndex:1];
NSLog(@"%@", array4);
//5.删除元素
//元素
[array4 removeObject:@"zzz"];
NSLog(@"%@", array4);
//下标
[array4 removeObjectAtIndex:2];
NSLog(@"%@", array4);
//6.替换元素
[array3 replaceObjectAtIndex:2 withObject:@"SS"];
NSLog(@"%@", array3);
//7.交换指定位置的两个元素
[array3 exchangeObjectAtIndex:1 withObjectAtIndex:2];
NSLog(@"%@", array3);
//8.根据对象来交换两个元素位置
NSUInteger a = [array3 indexOfObject:@"SS"];
NSUInteger b = [array3 indexOfObject:@"asdf"];
[array3 exchangeObjectAtIndex:a withObjectAtIndex:b];
NSLog(@"%@", array3);