本文介绍了Segue Unwind 回到最后一个特定的 View 控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让一个按钮回到特定的视图控制器?例如,假设我有 ViewController A 和 B.两者都模态地转至 ViewController C.现在我了解如何转回之前的视图控制器之一(正如这里所解释的)但我如何返回到呈现 VC C 的特定视图控制器?

Is there a way to have one button unwind back to a specific view controller? For example suppose I have ViewController A and B. Both modally segue to ViewController C. Now I understand how to segue unwind back to one of the previous view controllers (As was explained here) but how do I go back to the specific view controller that presented VC C?

总而言之,我想弄清楚的是......如果 A segued 到 C 那么我想在选择按钮时回到 A .如果 B 转到 C,那么我想在选择按钮时回到 B.

So to sum it up, what I'm trying to figure out is...If A segued to C then I want to unwind back to A when the button is selected. If B segued to C then I want to unwind back to B when the button is selected.

推荐答案

您应该使用标准方式从模态转场返回.把它放在你的后退"按钮...

You should use the standard way to return from a modal segue. Put this in your 'back' button...

[[self presentingViewController] dismissViewControllerAnimated:YES];

这不使用 storyboard 或 segue 来返回,只使用代码.

This doesn't use the storyboard or a segue for the return, just code.

这篇关于Segue Unwind 回到最后一个特定的 View 控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 02:36