数字封装:
NSNumber *num1 = [NSNumber numberWithInt:100];// 普通封装
NSNumber *num2 = @100;//语法糖
bool值:
NSNumber *boo1 = [NSNumber numberWithBool:YES];
NSNumber *boo2 = [NSNumber numberWithBool:NO];
数组:
NSArray *array1 = [NSArray arrayWithObjects:@"a", @"b", @"c", nil];
NSArray *array2 = @[@"a", @"b", @"c"];// 语法糖
字典:
NSDictionary *dic1 = [NSDictionary dictionaryWithObjectsAndKeys:@"value1", @"key2", @"value2", @"key", nil];
NSDictionary *dic2 = @{@"key1", @"value1", @"key2", @"value2"};// 语法糖
输出方法:
数组:
NSLog(@"%@", [array2 objectAtIndex:1]);
NSLog(@"%@", array2[1]);// 语法糖
字典:
NSLog(@"%@", [dic2 objectForKey:@"key2"]);
NSLog(@"%@", dic2[@"key2"]);