当我过渡回家庭控制器时,为什么导航栏消失了?

时间:2019-08-04 18:43:45

标签: swift

我的导航栏中嵌入了一个菜单按钮,它将带我进入菜单。但是,当我点击菜单页面上的“后退”按钮返回到原始主页时,导航栏消失了。

仅在我使用以下代码为两个VC之间的过渡设置动画之后,问题才出现:

菜单按钮的@objc功能:

    let transition = CATransition()
    transition.duration = 0.5
    transition.type = CATransitionType.push
    transition.subtype = CATransitionSubtype.fromRight
    transition.timingFunction = CAMediaTimingFunction(name:CAMediaTimingFunctionName.easeInEaseOut)
    view.window!.layer.add(transition, forKey: kCATransition)
    present(menuVC, animated: false, completion: nil)

和@objc函数用于backToHomePage按钮:

   let transition = CATransition()
    transition.duration = 0.5
    transition.type = CATransitionType.push
    transition.subtype = CATransitionSubtype.fromLeft
    transition.timingFunction = CAMediaTimingFunction(name:CAMediaTimingFunctionName.easeInEaseOut)
    view.window!.layer.add(transition, forKey: kCATransition)
    present(menuVC, animated: false, completion: nil)

我没有收到任何错误,但是如果我使用导航堆栈将菜单控件推到上方,该问题就消失了。

0 个答案:

没有答案