我正在使用 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 弹出当前视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!