How to hide navigation bar in iPhone?

后端 未结 7 555
悲&欢浪女
悲&欢浪女 2021-01-16 04:55

Currently i am working in iPhone app, I have two screen like A and B, A has no navigation bar, but B has navigation bar. so i set like this.

Class A:



        
7条回答
  •  滥情空心
    2021-01-16 05:19

    Your code is okay for Hide and Unhide the navigationBar. The problem is that you're hiding Class A's navigationBar in viewWillAppear: which is called just before appearing the view so before loading the Class A view navigationBar is being hidden each time.
    And if we talk about your blue color i think it is your window color. Because after hidden the navigationBar there will be a space above your self.view which height is 44.0. So there are three options to fixed it.

    • Hide Class A's navigationBar in Class A's viewDidAppear: method.
    • Set your window color what you want to show.
    • You can add an image to window background in which at top of image make a navigationBar same as Class B's navigationBar so when the original navigationBar will be hide it will see.

提交回复
热议问题