【问题标题】:How can I show the tab bar controller when I unwind from a view controller to another view controller that's a child of the tab bar controller?当我从视图控制器展开到另一个作为标签栏控制器子级的视图控制器时,如何显示标签栏控制器?
【发布时间】:2016-02-26 12:46:56
【问题描述】:

我有一个标签栏控制器和它的 3 个子节点,我还有另一个视图,我创建了一个从子节点到视图控制器的自定义转场,以及从视图控制器到子节点的自定义展开转场。问题是在展开时,标签栏是隐藏的,它会在展开完成时显示。

这是一个 GIF 示例:

这是我的自定义转场展开代码:

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)
    }
}
}

【问题讨论】:

标签: ios swift uitabbarcontroller segue unwind-segue


【解决方案1】:

为了使展开工作如我所说,展开转场需要从标签栏控制器完成,所以我创建了一个UITabBarController 并向其添加相同的展开。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-15
    • 1970-01-01
    • 1970-01-01
    • 2011-09-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多