开发者

Write in .plist file iphone/ipad?

   开发者_JAVA技巧 <dict>
        <key>Name</key>
        <string>Ramesh</string>
        <key>Address</key>
        <string>Delhi</string>
    </dict>

How do I write this in my plist file and at run time within any specific parent tag.


Just setting up this dictionary, this is how to write the plist to the apps directory.

NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:@"Name", @"Ramesh", @"Address", @"Delhi", nil];

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"dictionary.plist"];
[dictionary writeToFile:path atomically:YES];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜