NSMutableDictionary [英] NSMutableDictionary
本文介绍了NSMutableDictionary的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在另一个类中使用NSMutable词典从iphone中的plist文件读取和写入数据....
How to use NSMutable Dictionary in another class for read and write data from plist file in iphone....
有什么想法吗?
推荐答案
As you can find in in NSDictionary reference, this class has a method to create a nsdictionary from a file initWithContentsOfFile:(NSString *)path
. You can do something like:
NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"myDictionary" ofType:@"plist"];
NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:plistPath];
myDictionary是您的plist名称(如果plist在资源束中). 您可以使用以下方法在磁盘上写一个plist:
Where myDictionary is your plist name (In case of your plist is inside resource bundle). You can write a plist on disk with the method:
[dict writeToFile:filePath atomically: YES];
filePath是您的目标路径.
Where filePath is your destination path.
这篇关于NSMutableDictionary的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文