Replace a value in NSDictionary in iPhone

前端 未结 5 1366
悲哀的现实
悲哀的现实 2020-12-08 00:31

I have a array (dataArray) of NSDictionary \"item\". It has datas like \"david\" for key \"name\" and \"85\" for key \"marks\" etc for 5 students. I want to replace the mark

5条回答
  •  不知归路
    2020-12-08 01:18

    If you want to update an object in a NSDictionary you should use NSMutableDictionary instead. NSMutableDictionary has the following EXTRA methods

    Adding Entries

    • setObject:forKey:
    • setValue:forKey:
    • addEntriesFromDictionary:
    • setDictionary:

    Removing Entries

    • removeObjectForKey:
    • removeAllObjects
    • removeObjectsForKeys:

提交回复
热议问题