单击调用委托方法的按钮将删除plist中的项目

时间:2013-12-09 23:38:26

标签: ios objective-c ios7

在firstViewController我presentViewController:secondViewController包含从plist中的数组加载的选择器视图,在这个secondViewController中你可以添加一个项目到plist和picker视图,这个工作正常然后当我解雇secondViewController时,添加的项目仍然可以,但是当我点击firstViewController中的保存按钮时,添加的项目将从plist和picker视图中删除

中的

- (IBAction)saveButton:(id)sender {

Notes *myNote = [[Notes alloc]init];
//Declare a note called "myNote" and insert the Title, Text and Date properties of the note
[myNote setTitle:self.navigationItem.title andText:noteField.text andDate:dateLabel.text andCategory:categoryString];
//calls the noteAdded method in HomeViewController
[self.delegate noteAdded:myNote];
//Pop the New Notes View off the stack
[self.navigationController popViewControllerAnimated:YES];

}

单击此选项时,第二个视图中添加到数组中的所有项目都将从plist和pickerView中删除

如果我发表评论

 [self.delegate noteAdded:myNote];

然后该项目保留在plist中

抱歉,如果这听起来令人困惑

1 个答案:

答案 0 :(得分:0)

你可以在这里粘贴代码,以便我们可以搞清楚。我猜你在代码中错过了一点点/一点点。