为什么我的解开赛会走得太远? [英] Why does my unwind segue go back too far?

查看:114
本文介绍了为什么我的解开赛会走得太远?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我的应用的注册过程创建控制器架构。下面是当前状态的图像:

I'm trying to create the controller architecture for the signup process of my app. Below is an image of the current state:

应用程序首次在登录页面启动,如果用户单击SignUp,则通过 self.presentViewController 以模态方式显示导航控制器。然后导航控制器推动视图控制器,然后视图控制器推送到第二视图控制器。在该第二视图控制器上,用户必须首先按开始以模式导航到在继续注册过程之前请求附加信息的视图控制器。一旦用户在该模态呈现的控制器上输入附加信息,用户按下返回以通过展开segue返回到第二视图控制器。

The app starts at a login page the first time and if the user clicks "SignUp", a navigation controller is presented modally via self.presentViewController. The navigation controller then pushes through a view controller which then pushes to a second view controller. On this second view controller the user must first press "Go" to modally navigate to a view controller that requests additional information before continuing the signup process. Once the user inputs additional information on this modally presented controller, the user presses "Go Back" to return to the second view controller via an unwind segue.

然而,当这个按下unwind segue返回到第二个视图控制器,但随后立即返回登录页面。即使unwind函数嵌套在第二个视图控制器中,看起来unwind segue也会弹出所有模态显示的视图。

However, when this is pressed the unwind segue returns to the second view controller but then immediately returns to the "Log In" page. It seems like the unwind segue pops off all modally presented views even though the unwind function is nested within the second view controller.

发生了什么以及解开到第二个注册页面的解决方案是什么?

What's going on and what is the solution to unwinding to the second signup page?

推荐答案

我有同样的问题,这通常是由以下原因之一引起的:

I had this same issue and it was usually caused by one of the following reasons:


  1. 使用不推荐的segue

  2. 在用于展开的@IBAction方法中调用viewController.dismissViewControllerAnimated。

  3. 将@IBAction用于在错误的控制器中展开。 @IBAction应该在您要放松的控制器中。

展开segue的步骤


  1. 在SecondSignupController中创建一个@IBAction方法,此方法将在展开时调用。此方法应将UIStoryboardSegue作为参数示例 - >
    @IBAction func onUnwindFromModalPage(segue:UIStoryboardSegue){}。这种方法的主要目的是传回数据,否则你可以把它留空。

  1. Create an @IBAction method in SecondSignupController this method will be called upon unwind. This method should take a UIStoryboardSegue as an argument example -> @IBAction func onUnwindFromModalPage(segue:UIStoryboardSegue){}. The main purpose of this method is to pass back data if any otherwise you can leave it empty.

控制 - 从Go-Back按钮拖动到退出符号故事板中的模块化控制器。选择控制器时,退出符号是控制器顶部的最后一个符号。这将显示您可以选择放松的@IBActions列表。选择您在SecondSignUpController中创建的方法。

Control-Drag from Go-Back button to exit symbol in the Modally Presented Controller in storyboard. The exit symbol is the last symbol on top of the controller when a controller is selected. This will show you a list of @IBActions that you can choose for unwind. Choose the method you created in the SecondSignUpController.

这篇关于为什么我的解开赛会走得太远?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆