1

I have a problem with my app development in Xcode 11.3. I'm developing an app targeting iOS 13.2, and I've edited the navigation bar so that its background is black. However, I can't seem to find a way to delete or hide the title bar. Now it just looks like a big black bar.

All the other content is served over a webview, so that's why I'd need to remove the title bar but not the black background color in the navigation bar (where the time and battery, etc. are displayed). I hope you can help.

Here's the preview currently:

Preview image of my app

Thanks!

byaruhaf
  • 4,128
  • 2
  • 32
  • 50
Valdemart
  • 19
  • 4
  • Does this answer your question? [How to hide the title bar in the iPhone main window](https://stackoverflow.com/questions/1162719/how-to-hide-the-title-bar-in-the-iphone-main-window) – fishinear Jan 24 '20 at 18:40
  • Sorry but what is a "title bar" according to you? What is it, in the screen shot, that you want to remove? The big black area is the navigation bar, and you said you did that on purpose. – matt Jan 24 '20 at 19:13
  • @matt Sorry, got my wording a bit wrong. What I'd like to accomplish is: Remove the big empty black area on my navigation bar (in the picture below the notch), but also keep the black background on both sides of the notch, behind the clock and the wifi and battery icons. I just can't figure out how to do that. – Valdemart Feb 02 '20 at 15:53

1 Answers1

3

So it sounds like you want something like this:

enter image description here

So, in that screen shot:

  • We're in a navigation interface, but the navigation bar is hidden.

  • The green view is a stand-in for your "Aleksis" view. Its top is pinned to the bottom of the safe area.

  • There is also a black view. Its top is pinned to the top of its superview (the view controller's main view) and its bottom is pinned to the bottom of the safe area. It is behind the green view.

Here's the storyboard configuration I used:

enter image description here

Here's the view controller code:

override var preferredStatusBarStyle: UIStatusBarStyle { .lightContent }
override func viewDidLoad() {
    super.viewDidLoad()
    self.navigationController?.isNavigationBarHidden = true
}
matt
  • 515,959
  • 87
  • 875
  • 1,141
  • So essentially in my case I'd have to get the BlackView under my Web View, since the "Aleksis" bar, or in your case the GreenView is actually just some HTML within my webview. I've tried to figure out by your instructions on how to do it, but I haven't succeeded yet. Is there some other things I need to consider when doing this same with the BlackView and a Web View? – Valdemart Feb 15 '20 at 19:41
  • Sorry about that. I didn't grasp that the Aleksis view was just something inside a web view. So just run the black view behind the whole thing. In fact perhaps your view controller's view could _be_ the black view. The idea is just to supply a black background so that we see black when the navigation bar goes away. – matt Feb 15 '20 at 20:29