1.更加简洁
比如用方法定义一个NSNumber
NSNumber *number = [NSNumber numberWithInt:1];
NSNumber *number2 = @1;
2.更加清晰
比如定义一个NSDictionary
NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:@"liu",@"firstName",@"yuxiao",@"lastName",nil];
NSDictionary *dic2 = @{@"firstName":@"liu",@"lastName":@"yuxiao"};
3.更加安全
//你或许会以为这个array的长度为4,但实际为2
NSArray *array = [NSArray arrayWithObjects:@"你好",@"aaa",nil,@"haha",nil];
// NSArray *array2 = @[@"你好",@"aaa",nil,@"haha"]; 直接报错
4.通过字面量+muticopy的方式创建可变数组和可变字典
NSMutableArray *array3 = [@[@1,@2,@3] mutableCopy];
NSMutableDictionary *dic3 = [@{@"firstName":@"liu",@"lastName":@"yuxiao"} mutableCopy];