标签:字典 foundation框架 objective-c 存储对象 元素
#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]; }
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:字典 foundation框架 objective-c 存储对象 元素
原文地址:http://blog.csdn.net/u012701023/article/details/47079517