2

From doing several searches I have found that it is a common issue that the unwind segues were buggy when implementing a UITabBarController.

I created a simple UITabBarController with two views. View A and View B.

I followed the instructions at: Unwind Segue not working in iOS 8

The solution to add a custom class to the UITabBarController and use this:

CustomTabBarController.swift

import UIKit

class CustomTabBarController: UITabBarController {

override func viewControllerForUnwindSegueAction(action: Selector, fromViewController: UIViewController, withSender sender: AnyObject?) -> UIViewController? {
    var resultVC = self.selectedViewController?.viewControllerForUnwindSegueAction(action, fromViewController: fromViewController, withSender: sender)
    return resultVC
    }

}

I've connected a simple button on View B to pass a string to View A. I also gave the unwind segue an identifier when hooking it up to the Exit and set up preparForSegue with that specific identifier. I'm running Xcode 6.2.

It has still not worked correctly as it has for others. I've gotten the segue to work correctly with the same code without using the UITabBarController. Upon using the UITabBarController I click the button associated with the Exit and nothing happens, not even an error.

Please any insight would be gratefully appreciated.

Thank you

Community
  • 1
  • 1

1 Answers1

2

I had the same problem Marc. The issue gets fixed if you perform the segue, using "Modal" presentation instead of "Show".

Segue : Present Modally, Presentation : Current Context

And your issue will get solved.

bhavik shah
  • 744
  • 7
  • 11