ios 几种快速写法
//NSString .... NSString *str1 = @"str1"; NSLog(@"str %@",str1); //NSArray NSArray *arr1 = @[@"one",@"two",@"three",@"four",@YES,@(NO),@1,@(2)]; NSLog(@"count %d",arr1.count); NSLog(@"value %@",arr1[4]); //NSMutableArray NSMutableArray *arr2 = [@[@"oo",@"xxx"] mutableCopy]; /*[@[@(1), @(2), @(3), @(4), @(5), @(6), @(7), @(8), @(9), @(10)] mutableCopy] NSMutableArray *arr2 = [@[ [@{@"name" : @"Cersei Lannister", @"title" : @"Queen of the Seven Kingdoms", @"isFavourite" : @NO, @"image" : @"cersei" } mutableCopy], [@{@"name" : @"Jaime Lannister", @"title" : @"Kingslayer", @"isFavourite" : @NO, @"image" : @"jaime" } mutableCopy], [@{@"name" : @"Joffrey Baratheon", @"title" : @"The Illborn", @"isFavourite" : @NO, @"image" : @"joffrey" } mutableCopy], [@{@"name" : @"Tyrion Lannister", @"title" : @"The Halfman", @"isFavourite" : @NO, @"image" : @"tyrion" } mutableCopy], [@{@"name" : @"Tywin Lannister", @"title" : @"Lord of Casterly Rock", @"isFavourite" : @NO, @"image" : @"tywin" } mutableCopy]] mutableCopy]; */ [arr2 addObject:@"two"]; NSLog(@"count %d",arr2.count); NSLog(@"value %@",arr2[1]); //NSDictionary NSDictionary *dic1 = @{@"key1":@"value1",@"key2":@"value2"}; NSLog(@"count %d",dic1.count); NSLog(@"value %@",dic1[@"key1"]); //NSMutableDictionary NSMutableDictionary *dic2 = [@{@"key1":@"value1",@"key2":@{@"key22":@"value22",@"key222":@"value222"}} mutableCopy]; NSLog(@"count %d",dic2.count); NSLog(@"value %@",dic2[@"key2"][@"key222"]);