我有一个从视图控制器到B视图控制器的展开顺序。放松后,显示警告继续停止继续。如何确保在展开顺序完成后显示警报?
网络操作在B完成。操作完成后,响应将显示在视图控制器中。
我成功地做出了这个结构。但有一个问题:
当我尝试显示警报时,它显示但停止了继续。如何在赛季完成后确保提醒节目。
错误是在这里:
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.
开卷处理程序在一个:
@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){}
}
在乙开卷触发:
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 = ShareTableViewController
如何在确定完成后确保显示警报?
设置一个布尔值属性,说,'unwinding'在'unwindToFeed',然后在'viewDidAppear'在视图控制器等,检查是否'unwinding'是真的,如果是,则显示警报。 – Paulw11
工作感谢! –
这是迟到,但你可以尝试这样做http://stackoverflow.com/a/37602422/1552116如果你不想使用状态标志 – wyu