Navigation bar is moving up to statusbar

依然范特西╮ 提交于 2019-11-27 08:34:14

问题


I have a viewController. Which does not have navigationBar. I am pushing another viewController that has navigationBar. Which is going up I am using following code to show the navigationBar

self.navigationController?.setNavigationBarHidden(false, animated: false)

回答1:


I believe you trying to hide navigationBar in firstVC and show it in secondVC.

Try following method into your firstVC and make sure you embedded your firstVC with navigationController.

Your storyBoard flow layout should be look like below...

Implement below method in firstVC.

override func viewWillAppear(_ animated: Bool) {

    self.navigationController?.setNavigationBarHidden(true, animated: true)
}

override func viewWillDisappear(_ animated: Bool) {

    self.navigationController?.setNavigationBarHidden(false, animated: true)   
}

Output:Updated



来源:https://stackoverflow.com/questions/42120482/navigation-bar-is-moving-up-to-statusbar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!