我有一个从 A 视图控制器到 B 视图控制器的展开序列。
在B中完成了一次网络操作。操作完成后,响应将显示在A视图控制器中。
我成功地制作了这个结构。然而有一个问题:
当我尝试显示警报时,它会显示但会停止继续。我如何确保在 segue 完成后显示警报。
错误在这里:
2016-04-27 14:39:28.350 PROJECT[9100:128844] Presenting view controllers on detached view controllers is discouraged <PROJECT.FeedTableViewController: 0x7a928c00>.
2016-04-27 14:39:28.359 PROJECT[9100:128844] popToViewController:transition: called on <UINavigationController 0x7c12a800> while an existing transition or presentation is occurring; the navigation stack will not be updated.
A 中的展开处理程序:
@IBAction func unwindToFeed(segue: UIStoryboardSegue) {
jsonArray[rowFromShare!]["ApplicationDataUsers"] = jsonFromShare!
tableView.reloadData()
ShowErrorDialog("Success", message: successMessageFromShare!, buttonTitle: "OK")
}
//Error Dialog
func ShowErrorDialog(title:String, message:String, buttonTitle:String){
let alert = UIAlertController(title: title, message: message, preferredStyle: .Alert)
alert.addAction(UIAlertAction(title: "OK", style: .Default) { _ in })
self.presentViewController(alert, animated: true){}
}
在 B 中展开触发器:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "unwindToFeed"{
let feedTable = segue.destinationViewController as! FeedTableViewController
feedTable.rowFromShare = row
feedTable.jsonFromShare = jsonToShare
feedTable.successMessageFromShare = successMessageToShare
}
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
A = FeedTableViewController
B = 共享表视图控制器
如何确保 segue 完成后显示警报?