When an array is declared, then only we need to add the key value in the NSDictionary, for example
NSDictionary *normalDict = [[NSDictionary alloc]initWithObjectsAndKeys:@"Value1",@"Key1",@"Value2",@"Key2",@"Value3",@"Key3",nil];
we cannot add or remove key values in this NSDictionary
Where, as in NSMutableDictionary, we can add objects after array initialization using this method
NSMutableDictionary *mutableDict = [[NSMutableDictionary alloc]init];' [mutableDict setObject:@"Value1" forKey:@"Key1"]; [mutableDict setObject:@"Value2" forKey:@"Key2"]; [mutableDict setObject:@"Value3" forKey:@"Key3"];
to remove the key value we must use the following code
[mutableDict removeObject:@"Value1" forKey:@"Key1"];
Madhu Nov 15 '13 at 10:01 2013-11-15 10:01
source share