I have a tab bar controller and 3 childs of it, also I have another view which I made a custom segue from the childs to the view controller, and also a custom unwind segue from the view controller to the child. The problem is that while the unwind is happening, the tab bar is hidden and it shows when the unwind is finished.
Here´s a GIF example:
Here's my code of the custom segue unwind:
import UIKit
class AddMeCustomSegueUnwind: UIStoryboardSegue {
override func perform() {
// Assign the source and destination views to local variables.
let secondVCView = self.sourceViewController.view as UIView!
let firstVCView = self.destinationViewController.view as UIView!
let screenHeight = UIScreen.mainScreen().bounds.size.height
let window = UIApplication.sharedApplication().keyWindow
//window?.insertSubview(firstVCView, aboveSubview: secondVCView)
//window?.insertSubview(firstVCView, belowSubview: secondVCView)
window?.insertSubview(firstVCView, atIndex: 0)
// Animate the transition.
UIView.animateWithDuration(0.4, animations: { () -> Void in
secondVCView.frame = CGRectOffset(secondVCView.frame, 0.0, -screenHeight + 64)
}) { (Finished) -> Void in
self.sourceViewController.dismissViewControllerAnimated(false, completion: nil)
}
}
}
To make the unwind work as I said, the unwind segue needed to be done from the tab bar controller so I created a UITabBarController
and add the same unwind to it.