可变数组插入、删除

NSMutableArray *array = [NSMutableArray array];
    
    [array addObjectsFromArray:@[@"北",@"上",@"广",@"深"]];
    
    NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(2, 3)];
    
    [array insertObjects:@[@"00",@"11",@"22"] atIndexes:indexSet];
    
    
    PDNSLog(@"1 == %@",array);
    
    [array removeObjectsInArray:@[@"00",@"11",@"22"]];
    
    PDNSLog(@"2 == %@",array);
    
    [array insertObjects:@[@"44",@"55",@"66"] atIndexes:indexSet];
    
    PDNSLog(@"3 == %@",array);

你可能感兴趣的:(可变数组插入、删除)