使用字面量语法创建字符串、数值、数组、字典,更加简洁
代码语言:javascript复制NSString *str = @"string";
NSNumber *num = @12;
NSNumber *floatNum = @12.5f;
NSNumber *boolNum = @YES;
NSArray *arr = @[@"obj1",@"obj2"];
NSDictionary *dic = @{
@"name":@"MM",
@"age":@12
};
参考
Effective Objective-C 2.0 编写高质量iOS与OS X代码的52个有效方法