#import <Foundation/Foundation.h> int main(int argc, const char * argv[]) { //不可改变字典,创建后不可改变 NSDictionary * dic = [[NSDictionary alloc]initWithObjectsAndKeys:@"jack",@"name",@"18",@"age", nil]; NSLog(@"%@",dic); NSDictionary * dic1 = @{@"name":@"jack",@"age":@"18"}; NSLog(@"dic1 %@",dic1); NSNumber * num = [NSNumber numberWithInt:10]; NSArray * array = @[@"one",@"two",@"three"]; NSDictionary * dic2 = @{@"array":array, @"num":num, @"dic":dic }; }
#import <Foundation/Foundation.h> int main(int argc, const char * argv[]) { NSMutableDictionary * dic = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"Tom",@"name" ,@"20",@"age",nil]; }
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-10-09 06:43:40