简体   繁体   中英

How has standard unwind segue changed in iOS 9?

I have an app with a main controller that pushes a child controller where the user makes a selection. At the top of this controller are cancel/save nav buttons, which dismiss the child and pass the data back to the parent. This works fine in iOS 8.

  • The storyboard shows the nav buttons hooked up to unwind to methods on the parent
  • The unwind methods exist on the parent
  • The child is pushed with a standard push segue

In iOS 9, the buttons do nothing. The shouldPerformSegue... isn't called. Changing to custom segue doesn't do anything either.

In other places in the app, the same behaviour manifests. Things that were pushed cannot be dismissed. Modals still work as expected.

We've looked at the WWDC video. Couldn't find the relevant change.

Has anyone else had this problem?

I had a similar issue and found having the unwind method only in the parent view controller class I wanted fixed the issue. Previously, I had the same named unwind method in each view controller a user would have gone thru so in effect stepping them back one view at a time during the unwind. Removing all of the unwind methods except in the "top most" view worked for me.

To the parent controller try adding:

override func viewControllerForUnwindSegueAction(action: Selector, fromViewController: UIViewController, withSender sender: AnyObject?) -> UIViewController? {
    return fromViewController
}

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