在新ViewController

时间:2018-05-10 09:05:54

标签: ios swift autolayout

我有这样的视图层次结构 TabBarController - > NavigationController - > TableViewController

当我点击按钮想要在没有tabBar的情况下推送新的VC时,正如你在GIF tabBar上看到的那样正确地隐藏了但是当按下VC时屏幕上的元素没有正确放置,它需要大约半秒钟适当调整。这是为什么? 在我的TableViewController中我有

@IBAction func presentPlayerPressed() {
    performSegue(withIdentifier: "player", sender: nil)
}

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    if let destination = segue.destination as? PlayerViewController {
        destination.hidesBottomBarWhenPushed = true
    }
}

但我也尝试在Storyboard中设置hides bottom bar on push,它会产生同样的效果

这也不会改变任何东西

    @IBAction func presentPlayerPressed() {
    let vc = storyboard!.instantiateViewController(withIdentifier: "playerVC")
    vc.hidesBottomBarWhenPushed = true
    navigationController?.pushViewController(vc, animated: true)
}

enter image description here

0 个答案:

没有答案