Reputation: 253
I have a plist. I want to edit values for key called "FAV" when a button clicked. But I can't make it change. How can I do it? Thank you.
[[self.dataList objectAtIndex:ind] setValue:@"0" forKey:@"FAV"];
Here is a part of plist:
<plist version="1.0">
<array>
<dict>
<key>ID</key><string>1</string>
<key>SEARCHNAME</key><string>key1</string>
<key>ISGROUP</key><string>0</string>
<key>CODE</key><string>000.0</string>
<key>NAME</key><string>Name1</string>
<key>PARENTID</key><string>0</string>
<key>FAV</key><string>0</string>
</dict>
<dict>
<key>ID</key><string>2</string>
<key>SEARCHNAME</key><string>key2</string>
<key>ISGROUP</key><string>0</string>
<key>CODE</key><string>000.0</string>
<key>NAME</key><string>Name2</string>
<key>PARENTID</key><string>0</string>
<key>FAV</key><string>0</string>
</dict>
Upvotes: 0
Views: 88
Reputation: 91
What is datelist?? i think its dic.
Read the dictionary from file ,then update the dictionary then write that dictionary back into the file.
Upvotes: 1