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]];
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]];