不积跬步,无以至千里;不积小流,无以成江海

Our practice

不积跬步,无以至千里;不积小流,无以成江海

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
plist文件是标准的xml文件.

A).写入plist文件:(Dictionary/Array)
NSMutableDictionary* dict = [ [ NSMutableDictionary alloc ] initWithContentsOfFile:@"/Sample.plist" ];
[ dict setObject:@"Yes" forKey:@"RestartSpringBoard" ];
[ dict writeToFile:@"/Sample.plist" atomically:YES ];

B).读取plist文件:

//读取工程中的plist,初始化Dictionary。
NSMutableDictionary* dict =  [ [ NSMutableDictionary alloc ] initWithContentsOfFile:@"/Sample.plist" ];
NSString* object = [ dict objectForKey:@"RestartSpringBoard" ];

//读取目录下的plist文件到 NSMutableDictionary 中    
NSMutableDictionary* dictplist = [[NSMutableDictionary alloc ] initWithContentsOfURL:[NSURL fileURLWithPath:path]];
posted on 2011-02-15 13:25  英怀  阅读(3784)  评论(0编辑  收藏  举报