在 iOS 5 上使用 Segues/Storyboard 弹出当前视图

Pop the current view using Segues/Storyboard on iOS 5(在 iOS 5 上使用 Segues/Storyboard 弹出当前视图)
本文介绍了在 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 弹出当前视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

AWS DynamoDB Batch Get Request - iOS(AWS DynamoDB 批量获取请求 - iOS)
Querying DynamoDB on non-key attributes(在非关键属性上查询 DynamoDB)
DynamoDB auto incremented ID amp; server time (iOS SDK)(DynamoDB 自动递增 ID amp;服务器时间(iOS SDK))
Where to find a clear explanation about swift alert (UIAlertController)?(哪里可以找到关于 swift alert (UIAlertController) 的清晰解释?)
Facebook Requests Dialog: Frictionless Requests in native iOS app possible?(Facebook 请求对话框:本机 iOS 应用程序中的无摩擦请求可能吗?)
dynamodb scanexpression with scan filter in objective-c(在objective-c中带有扫描过滤器的dynamodb scanexpression)