Hiding the tabbar and removing the space

前端 未结 14 1686
生来不讨喜
生来不讨喜 2020-11-30 00:10

Is there a way to hide tabbar and remove that space left (around 50px) ?

I tried

self.tabBarController?.tabBar.hidden = true
self.extendedLayoutIncl         


        
14条回答
  •  遥遥无期
    2020-11-30 01:06

    Sometimes that easiest way is just to add a view that uses the UIScreen bounds.

    let whiteView = UIView()
        whiteView.backgroundColor = .white
        view.addSubview(whiteView)
        whiteView.translatesAutoresizingMaskIntoConstraints = false
        whiteView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
        whiteView.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
        whiteView.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
        whiteView.heightAnchor.constraint(equalToConstant: UIScreen.main.bounds.height).isActive = true
    

    Cause sometimes the view edges extends beyond the nav bar giving you new problems if you extend the view layout.

提交回复
热议问题