网络 *** 作在B中完成. *** 作完成后,响应将显示在A视图控制器中.
我成功地建立了这个结构.但是有一个问题:
当我试图显示警报时,它显示但停止了segue. 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 Dialogfunc 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 = SharetableVIEwController
segue完成后如何确保显示警报?
解决方法 正如您所发现的那样,在展开segue完成之前调用unwindToFeed方法.一种方法是在unwindToFeed方法中设置一个布尔值,然后在知道segue完成时在vIEwDIDAppear中检查这个布尔值.如果设置了布尔值,则可以显示警报:
@IBAction func unwindToFeed(segue: UIStoryboardSegue) { JsonArray[rowFromShare!]["ApplicationDataUsers"] = JsonFromShare! tableVIEw.reloadData() self.unwinding = true}overrIDe func vIEwDIDAppear(animated: Bool) { super.vIEwDIDAppear(animated) if (self.unwinding) { self.ShowErrorDialog("Success",buttonTitle: "OK") self.unwinding=false }总结
以上是内存溢出为你收集整理的ios – 放松后显示警报segue停止了segue.展开segue完成后如何确保显示警报?全部内容,希望文章能够帮你解决ios – 放松后显示警报segue停止了segue.展开segue完成后如何确保显示警报?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)