简体   繁体   中英

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

如果我有一个带有4个键值对的NSMutableDictionnary(存储在.plist中),当从.plist加载字典时,如何仅修改其中一个键值对而不删除其余键对?

您可以为给定键更改单个值,如下所示:

[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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM