开发者

How to modify only one Key-Value pair in an NSMutableDictionnary

开发者 https://www.devze.com 2023-02-13 12:24 出处:网络
If I have an NSMutableDictionnary with 4 Key Value pairs (stored in a .plist), When I load the dictionary from the .plist how can I开发者_开发知识库 modify only one of the Key Value Pairs without eras

If I have an NSMutableDictionnary with 4 Key Value pairs (stored in a .plist), When I load the dictionary from the .plist how can I开发者_开发知识库 modify only one of the Key Value Pairs without erasing the rest?


You can change a single value for the given key like so:

[dict setValue:@"value" forKey:@"key"];


[dictionary setObject:value forKey:key] will assign the value for the specified key; [dictionary removeObjectForKey:key] will remove the key-value pair completely.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号