简体   繁体   English

使用performSegueWithIdentifier放松Segue-不起作用-Swift 2.1

[英]Unwind Segue using performSegueWithIdentifier - Doesn't work - Swift 2.1

I am trying to unwind in my button click, after receiving response. 收到回复后,我试图放松按钮的单击。

LoginController LoginController

@IBAction func SignInPressed(sender: AnyObject) {

  if (onSuccess) {
      performSegueWithIdentifier("unwindToGlobal", sender: AnyObject?())
  }
}

and this is where it comes from (GlobalController). 这就是它来自(GlobalController)的地方。

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?)
{
    if (segue.identifier == "globalToLogin")
    {
        NSOperationQueue.mainQueue().addOperationWithBlock({ () -> Void in
            let loginController = segue.destinationViewController as? LoginController
        })
    }
}

This one works and as soon as I enter the app (GlobalController is the starting view), I get directed to Login Page. 这是可行的,一旦我进入应用程序(GlobalController是初始视图),我就被定向到登录页面。 However, when I click on the login button on LoginController, unfortunately it doesn't unwind. 但是,当我单击LoginController上的登录按钮时,不幸的是它不会展开。

在此处输入图片说明

在此处输入图片说明

When I try to remove these connections and ctrl + drag button to exit, it just doesn't do anything. 当我尝试删除这些连接并按ctrl + drag按钮退出时,它什么也没做。

I couldn't find what I am doing wrong, thus it's not working. 我找不到我在做什么错,因此无法正常工作。 What am I missing? 我想念什么?

Here a fews of articles about Unwind, that was super for me, maybe that can help 这里有一些关于Unwind的文章,对我来说太好了,也许可以帮上忙

Unwind 放松

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

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