我的问题是,密钥是否受到保护而不被更改意味着除非我将其删除并将另一个添加到字典中,否则它将始终相同?
谢谢.
解决方法 设置项目时,键是-copy’d,因此您无法在之后更改它是无用的.Methods that add entrIEs to dictionarIEs—whether as part of initialization (for all dictionarIEs) or during modification (for mutable dictionarIEs)—copy each key argument (keys must conform to the
NScopying
protocol) and add the copIEs to the dictionary. Each corresponding value object receives a retain message to ensure that it won’t be deallocated before the dictionary is through with it.
您可以将CFDictionary与kcfTypeDictionaryKeyCallBacks一起使用,或者只需替换该项:
ID value = [dictionary objectWithKey:oldKey];[dictionary setobject:value withKey:newKey];[dictionary removeObjectForKey:oldKey];总结
以上是内存溢出为你收集整理的objective-c – 我可以更改NSDictionaries密钥吗?全部内容,希望文章能够帮你解决objective-c – 我可以更改NSDictionaries密钥吗?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)