我已經看到了很多關於這個問題,但似乎找不到一個適合我的需求。閱讀寫作plist Iphone
我有一個plist中,看起來像這樣
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Content</key>
<array>
<dict>
<key>dateAdd</key>
<date>2011-03-23T14:40:47Z</date>
<key>content</key>
<string>Content first</string>
<key>Title</key>
<string>Title 1</string>
</dict>
<dict>
<key>dateAdd</key>
<date>2011-03-23T14:40:47Z</date>
<key>content</key>
<string>Content here</string>
<key>Title</key>
<string>Title 2</string>
</dict>
</array>
</dict>
</plist>
林取出由這樣
plist中的信息在第一類中
//points to the plist
NSString *path = [[NSBundle mainBundle] bundlePath];
NSString *url = [path stringByAppendingPathComponent:@"Details.plist"];
//filling with contents of plist
NSDictionary *Data = [[NSDictionary alloc] initWithContentsOfFile:url];
self.contentData = Data;
[Data release];
在第二類我創建此類的實例並獲取信息
Petite_NotesAppDelegate *instance = (Petite_NotesAppDelegate *)[[UIApplication sharedApplication] delegate];
self.dataArray = [instance.contentData objectForKey:@"Content"];
這使得有可能獲得從plist中這樣
NSDictionary *Content = [self.dataArray objectAtIndex:indexPath.row];
cell.textLabel.text = [Content objectForKey:@"Title"];
我的問題是我不能夠寫的plist
因爲我想寫的內容是在plist中的內容數組內容,然後在項目0項目1等內。我將如何寫入plist內容數組內?比方說,我想寫一個文本字段的內容...
感謝您的任何幫助!
處理看看這有助於。 [PropertyLists/Introduction](http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/PropertyLists/Introduction/Introduction.html#//apple_ref/doc/uid/10000048-CJBGDEGD) – 2011-03-24 09:36:18