简体   繁体   English

从Storyboard ViewController返回到以前使用的.xib ViewController

[英]Going back from Storyboard ViewController to a previously used .xib ViewController

I have an app that runs through a sequence of view controllers. 我有一个通过一系列视图控制器运行的应用程序。 We'll diagram it like this: 我们将这样绘制它:

IntroViewController -> MenuViewController -> Test1StoryBoard
                                          -> Test2ViewController
                                          -> Test3ViewController

Where there is an intro screen, then a menu screen where you can select Test1, Test2, or Test3. 在有介绍屏幕的地方,然后是菜单屏幕,您可以在其中选择Test1,Test2或Test3。 However, as this is a rather large app that was made by several people, I made Test 1 as a storyboard while the rest are .xibs. 但是,由于这是一个由几个人共同开发的大型应用程序,因此我将Test 1用作情节提要,而其余均为.xibs。 At the end of Test1, I want to go back to MenuViewController, so I used: 在Test1结束时,我想回到MenuViewController,所以我使用了:

mVC = [[MenuViewController alloc] init];
self.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:mVC animated:YES completion:nil];

This bit of code successfully takes the user back to MenuViewController. 此段代码成功将用户带回到MenuViewController。 However, once we are back in MenuViewController, the buttons that would ordinarily take the user back to Test1, Test2, or Test3 do not work. 但是,一旦我们回到MenuViewController,通常会使用户返回Test1,Test2或Test3的按钮将不起作用。 There are no error messages, but nothing at all happens when they are clicked. 没有错误消息,但是单击它们根本没有任何反应。 I understand this question is a little vague and would be happy to provide more code if necessary, but can anyone shed any light on what the problem might be? 我知道这个问题有点含糊,愿意在必要时提供更多代码,但是任何人都可以对问题可能有什么了解吗?

When you are going from Test1 to MenuVC, do not create new view controller again. 从Test1转到MenuVC时,不要再次创建新的视图控制器。 Either call dismissViewControllerAnimated:completion: or call popViewControllerAnimated: method depending upon what you had used to present Test1 or Test2 or Test3 which is either presentViewController:animated:completion: or pushViewController:animated respectively. 调用dismissViewControllerAnimated:completion:或调用popViewControllerAnimated:方法,具体取决于您用来呈现Test1或Test2或Test3的内容,它们分别是presentViewController:animated:completion:pushViewController:animated

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM