e.ozmen
e.ozmen

Reputation: 253

Edit a specific item's value for a key of a plist

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

Answers (1)

Dhanunjay Kumar
Dhanunjay Kumar

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

Related Questions