简体   繁体   中英

Unwind Segue using performSegueWithIdentifier - Doesn't work - Swift 2.1

I am trying to unwind in my button click, after receiving response.

LoginController

@IBAction func SignInPressed(sender: AnyObject) {

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

and this is where it comes from (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. However, when I click on the login button on LoginController, unfortunately it doesn't unwind.

在此处输入图片说明

在此处输入图片说明

When I try to remove these connections and ctrl + drag button to exit, it just doesn't do anything.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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