【发布时间】:2018-03-07 19:52:59
【问题描述】:
如何关闭从标签栏视图中的视图打开的模式视图并停留在该视图上?
登录后我有一个标签栏视图,标签视图上有两个视图(客户端和配置文件)。
在客户上,我有一个客户列表,我可以打开另一个显示发票的视图。
点击发票,它会显示特定发票的详细信息。
在这个视图上,有一个带有一些按钮的 actionView。
其中一个按钮是“付款”。
点击付款时,会显示一个模式窗口。
但是,当我点击取消按钮时,它会删除所有视图并返回登录视图(初始视图)
发票视图
@IBAction func showActionAlert(_ sender: Any) {
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
let payButton = UIAlertAction(title: "Make Payment", style: .default, handler: { (action) -> Void in
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let controller = storyboard.instantiateViewController(withIdentifier: "MakePaymentViewController")
self.present(controller, animated: true, completion: nil)
})
let voidButton = UIAlertAction(title: "Void", style: .destructive, handler: { (action) -> Void in
})
let deleteButton = UIAlertAction(title: "Delete", style: .destructive, handler: { (action) -> Void in
})
let cancelButton = UIAlertAction(title: "Cancel", style: .cancel, handler: { (action) -> Void in })
alertController.addAction(payButton)
alertController.addAction(voidButton)
alertController.addAction(deleteButton)
alertController.addAction(cancelButton)
self.navigationController!.present(alertController, animated: true, completion: nil)
}
模态视图
@IBAction func cancelButton(_ sender: Any) {
let tmpController :UIViewController! = self.presentingViewController;
self.dismiss(animated: false, completion: {()->Void in
tmpController.dismiss(animated: true, completion: nil);
});
}
【问题讨论】:
标签: swift view modal-dialog uitabbarcontroller