当我确认表单时,如何回到我的视图?
我是我为我的应用下载了MZFormSheetController库。当我确认表单时,如何回到我的视图?
我的弹出窗口有问题。当我在我的TableViewController上时,我点击一行以打开弹出窗口,以便我可以更改名称。弹出窗口打开,我设置了名称,当我点击按钮来更正名称时,我调用了按钮方法,但在重新加载列表时我无法关闭弹出窗口。
- (IBAction)modifierTournoi:(id)sender {
//code to update database
//this method close the popup but don't call method viewWillAppear to reload database
//I don't know what method i can use..?
[self dismissFormSheetControllerAnimated:YES completionHandler:^(MZFormSheetController *formSheetController) {
}];
}
在此之前,我使用popViewControllerAnimated方法返回我的列表,同时充电我的列表。
- (IBAction)modifierJoueur:(id)sender {
//code to update database
[self.navigationController popViewControllerAnimated:true];
}
你能帮我吗?
非常感谢。
它看起来像有就是为了这个目的内置到您正在使用该库的具体完成处理程序:
- (IBAction)modifierTournoi:(id)sender {
//code to update database
//this method close the popup but don't call method viewWillAppear to reload database
//I don't know what method i can use..?
[self dismissFormSheetControllerAnimated:YES completionHandler:^(MZFormSheetController *formSheetController) {
// Reloading your database should work in here.
}];
}
原因viewWillAppear中不会被称为是因为而不是放置的viewController模态的窗口上方,我想MZFormSheetController会在所有呈现的UIViews上添加一个UIView,所以viewWillAppear将永远不会被调用。但正如我上面所说,你应该能够在完成处理程序块中重新加载。
好的,我重新加载完成处理程序块中的数据。我发送我的TableView和我的NSMutableArray重新加载我的segue中的数据。 但我的表列表不再进行重装...... [自dismissFormSheetControllerAnimated:YES completionHandler:^(MZFormSheetController * formSheetController){ self.listeTournois = [TournoiBdd getAllTournois] [self.tournoiTableView reloadData]; }]; – 2014-10-20 18:47:02
如果我要从这里开始帮助,可能需要更多的代码实现。你有没有尝试断点检查tableView:cellForItemAtIndexPath:是否在调用reloadData之后调用tableView方法?或者,甚至可以在完成块中插入一个断点,以确保正在调用! – simonthumper 2014-10-20 18:55:35
哦,谢谢,我忘了在cellForRowAtIndexPath中添加断点,我只是调用方法重新加载我的数组在cellForRowAtIndexPath方法的开始,它的工作! 非常感谢simonthumper! – 2014-10-20 19:29:04
提供您编写的代码将极大地帮助人们更好地理解您的问题。 – spassas 2014-10-20 16:38:59