NSMutableDictionary setValue forKey
- (void)setValue:(id)value forKey:(NSString *)key
Parameters of [NSMutableDictionary setValue forKey]
value
The value for key.
key
The key for value. Note that when using key-value coding, the key must be a string (see “Key-Value Coding Fundamentals”).
Discussion of [NSMutableDictionary setValue forKey]
This method adds value and key to the dictionary using setObject:forKey:, unless value is nil in which case the method instead attempts to remove key using removeObjectForKey:.
NSMutableDictionary setValue forKey example.
NSMutableDictionary *parameters = [[NSMutableDictionary alloc] init];
[parameters setValue:[NSNumber numberWithBool:news] forKey:@"news"];
[parameters setValue:[NSNumber numberWithBool:mails] forKey:@"mails"];
[parameters setValue:[NSNumber numberWithBool:news] forKey:@"news"];
[parameters setValue:[NSNumber numberWithBool:mails] forKey:@"mails"];