sal*_*hni -1 python list objective-c nsdictionary
这是python中的一个例子
temy_dict_list = []
my_dict_list.append({'text':'first value', 'value':'number 1'})
my_dict_list.append({'text':'second value', 'value':'number 2'})
my_dict_list.append({'text':'third value', 'value':'number 3'})
Run Code Online (Sandbox Code Playgroud)
我想在Objective-C中实现与此相同的东西!
我该如何实施呢?我想要一本字典清单!
NSMutableArray* list = [NSMutableArray array];
[list addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"first value",@"text", @"number 1",@"value", nil]];
[list addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"second value",@"text", @"number 2",@"value", nil]];
[list addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"third value",@"text", @"number 3",@"value", nil]];
Run Code Online (Sandbox Code Playgroud)