Pop the current view using Segues/Storyboard on iOS 5(在 iOS 5 上使用 Segues/Storyboard 弹出当前视图)
问题描述
我正在使用 iOS 5 SDK 创建一个应用程序.我设法使用 Storyboard 的 Segues 推送视图,但我找不到弹出当前视图并返回上一个视图的正确方法.
I am creating an app using iOS 5 SDK. I managed to push views using the Storyboard's Segues, but I cannot find the proper way to pop the current view and go back to the previous one.
我没有使用任何导航控制器(该应用没有任何顶部或底部栏).
I am not using any navigationController (the app doesn't have any top or bottom bars).
我认为使用 modal 或 push segue 不是解决方案,因为它会实例化一个新的控制器.
I don't think using modal or push segue the other way would be the solution as it instantiates a new controller.
我是否必须使用带有相反动画的自定义 Segue 并在最后删除视图?还是有更好的办法?
Do I have to use a custom Segue with the opposite animation and deletion of the view at the end ? Or is there a better way ?
推荐答案
您可以尝试从您要关闭的控制器调用 [self dismissViewControllerAnimated:YES completion:nil];
(无论控制器是否有被推送,或模态显示).
You could try calling [self dismissViewControllerAnimated:YES completion:nil];
from the controller you want to dismiss (whether the controller has been pushed, or shown modally).
这里是相关文档:UIViewController 类参考
呈现视图控制器负责关闭它呈现的视图控制器.如果您在呈现的视图控制器本身上调用此方法,它会自动将消息转发到呈现的视图控制器.
The presenting view controller is responsible for dismissing the view controller it presented. If you call this method on the presented view controller itself, it automatically forwards the message to the presenting view controller.
这篇关于在 iOS 5 上使用 Segues/Storyboard 弹出当前视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 iOS 5 上使用 Segues/Storyboard 弹出当前视图


基础教程推荐
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01