如何在uipageviewcontroller swift中过渡时隐藏导航栏

时间:2018-07-21 05:14:59

标签: ios swift uipageviewcontroller

我有一个uipageviewcontroller,我正在从其他视图控制器推送 以下代码:-

self.navigationController?.pushViewController(rideDetailsPageViewController, animated: true)

当我尝试在uipageviewcontroller中滑动时,会显示导航栏。如何预防呢?

1 个答案:

答案 0 :(得分:1)

如果要隐藏导航栏,请使用以下rideDetailsPageViewController的代码方法

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self.navigationController?.isNavigationBarHidden = true
    }

    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        self.navigationController?.isNavigationBarHidden = false
    }