ios - 关闭 ViewControllers 以返回之前的 ViewController
问题描述
我的故事板设置非常简单。我有两个视图,左边一个是默认的,有时应用程序会切换到第二个视图。
如果不实例化新的根 ViewController,我不会让它切换回来。显然,每次我“关闭”第二个视图控制器时,都会创建一个新的根 ViewController,而不是使用之前存在的那个。我不使用 NavigationControllers,我只想在两个视图之间切换。
我用来呈现第二种观点的东西
let infoView = self.storyboard?.instantiateViewController(withIdentifier: "infoboard") as! InfoBoardViewController
self.present(infoView, animated: false, completion: nil)
我用什么来解雇它
UIApplication.topViewController()?.dismiss(animated: false, completion: nil)
解决方案
推荐阅读
- python - 如何从python中的列表中删除零值列表
- python - 如何从一个 locustfile 中生成 1800 rps?
- ios - 使用变换反馈等技术将图像中的特定像素从 GPU 获取到 CPU
- python - python如何从xy图上的原点旋转/旋转
- ruby-on-rails - 从控制器提交表单后渲染表格
- javascript - 如何使用 HTML/CSS 拖放元素?
- go - 仅从内部代理下载私有模块并从外部代理获取公共模块
- ios - iOS App订阅附加支付方式
- android - 如何在 Android 应用程序中使用 Jsoup 显示网站中的某些文本?
- oauth - Google 日历 API 错误 - “API 密钥无效。请传递有效的 API 密钥。”,