2

嘿,好吧,所以我有一个看起来像的 .plist;

<plist version="1.0">
<dict>
 <key>Item 0</key>
  <dict>
    <key>Name</key>
    <string>Jero</string>
    <key>Initiative</key>
    <integer>0</integer>
    <key>EditThis</key>
    <false/>
 </dict>
</dict>
</plist>

In the app I have it so that when one of the rows (The data is put in a UITableView) is selected it pushes to a new view controller. 我还想将“EditThis”布尔值设置为“是”,以便编辑视图控制器可以了解要编辑的内容。但是我似乎无法弄清楚如何更改该值。任何帮助深表感谢。

4

1 回答 1

10

将 plist 加载到可变字典中:

NSMutableDictionary *plist = [NSMutableDictionary dictionaryWithContentsOfFile:@"file.plist"];
[plist setObject:[NSNumber numberWithBool:YES] forKey:@"EditThis"];
[plist writeToFile:@"file.plist" atomically:YES];
于 2009-11-05T12:54:43.183 回答