#import <foundation/foundation.h>int Main (int argc, const char * argv[]) { //non-changing dictionary, cannot be changed after creation Nsdictionary * dic = [[Nsdictionary alloc]initwithobjectsandkeys:@ "Jack", @ "name", @ "@", @ "age", nil]; NSLog (@ "%@", dic); Nsdictionary * Dic1 = @{@ "name": @ "Jack" @ "age": @ "@"}; NSLog (@ "Dic1%@", dic1); NSNumber * num = [nsnumber numberwithint:10]; Nsarray * array = @[@ "One", @ "one", @ "three"]; Nsdictionary * Dic2 = @{@ "array": Array, @ "num": num, @ "dic":d ic };}
#import <foundation/foundation.h>int Main (int argc, const char * argv[]) { nsmutabledictionary * dic = [[ Nsmutabledictionary alloc] initwithobjectsandkeys:@ "Tom" @ "name" @ "@" @ "age", nil];}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Variable dictionaries and immutable dictionaries in OC