我有两个文本框,当我按下提交时,我想将此文本框的数据存储到 Plist 中。到目前为止我已经完成了编写代码,但问题是如何编写文本框的数据?就像我有 textbox1 和 textbox2 。想将数据存储到 plist
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Comments" ofType:@"plist"];
NSMutableArray *plistArray = [[NSMutableArray alloc] initWithContentsOfFile:filePath];
NSMutableDictionary *newComment = [NSMutableDictionary dictionary];
[newComment setValue:commentTitle.text forKey:@"title"];
[newComment setValue:comment forKey:@"comment"];
[plistArray addObject:newComment];
[plistArray writeToFile:filePath atomically:NO];
请建议我正确的方法