我有一个标签栏控制器和它的 3 个孩子,我还有另一个视图,我从孩子到视图控制器做了一个自定义的 segue,还有一个从视图控制器到孩子的自定义展开 segue。问题是在展开时,标签栏是隐藏的,它会在展开完成时显示。
这是一个GIF示例:
这是我的自定义segue展开代码:
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)
}
}
}