[英]Save and read data from plist?
I have some data stored in a plist and displayed in a tableview. 我有一些数据存储在plist中并显示在tableview中。 It's an array of dictionaries.
这是一系列词典。 It looks something like this:
它看起来像这样:
<array>
<dict>
<key>title</key>
<string>Title 1</string>
<key>image</key>
<string>test.png</string>
<key>description</key>
<string>Description 1</string>
</dict>
<dict>
<key>title</key>
<string>Title 2</string>
<key>image</key>
<string>test2.png</string>
<key>description</key>
<string>Description 2</string>
</dict>
How can I extract the data to save the items from the first dictionary into a new plist so I can display it somewhere else. 如何提取数据以将第一个字典中的项目保存到新的plist中,以便我可以将其显示在其他位置。
I think this is how You extract the array from plist: 我认为这是你从plist中提取数组的方法:
NSString* plistPath = [[NSBundle mainBundle] pathForResource:@"filename" ofType:@"plist"];
NSArray* contentArray = [NSArray arrayWithContentsOfFile:plistPath];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.