Posted on 2012-05-27 09:09
RTY 阅读(1062)
评论(0) 编辑 收藏 引用 所属分类:
编程常识 、
C/C++ 、
Mac os
http://www.cocoachina.com/b/?p=237
plist文件是标准的xml文件,在cocoa中可以很简单地使用。这里介绍一下使用方法:
以下代码在Mac和iPhone中均适用。
写入plist文件:
NSMutableDictionary* dict = [ [ NSMutableDictionary alloc ] initWithContentsOfFile:@"/Sample.plist" ];
[ dict setObject:@"Yes" forKey:@"RestartSpringBoard" ];
[ dict writeToFile:@"/Sample.plist" atomically:YES ];
读取plist文件:
NSMutableDictionary* dict = [ [ NSMutableDictionary alloc ] initWithContentsOfFile:@"/Sample.plist" ];
NSString* object = [ dict objectForKey:@"RestartSpringBoard" ];