ios定义数组和字典快捷方式

//标准写法
NSNumber * number = [NSNumber numberWithInt:1]; 
NSArray * array = [NSArray arrayWithObjects:@"one", @"two", nil]; 
NSDictionary * dict = [NSDictionary dictionaryWithObjectsAndKeys:@"value1", @"key1", @"value2", @"key2", nil]; 


//快捷写法
NSNumber * number = @1; 
NSArray * array = @[@"one", @"two"]; 
NSDictionary * dict = @{@"key1":@"value1", @"key2":@"value2"}; 

NSMutableArray *m_array = [@[] mutableCopy]; 
NSMutableDictionary *m_dict = [@{} mutableCopy];
posted @ 2019-04-29 17:14  哈特中尉  阅读(644)  评论(0编辑  收藏  举报