0

The below image shows the top of my viewController and interestingly the title "Example" is moved outside of the Navigation Controller area (darker blue). The light blue area (where the text is now) should not be there, instead the image should be just lining up since I set the layout constraint to 0 between the top layout guide and the image. There is not really any code, this is just done in Main Storyboard. The viewController you can see below was imbedded in a NavigationController (hence the navigation bar).

I tried things like the below to somehow get rid of the Navigation bar all together, but it did not work:

navigationController?.navigationBar.isTranslucent = true

or

self.navigationController?.view.backgroundColor = UIColor.clear

or set the title programmatically rather than in the Main Storyboard:

self.title = "Example Resources"

I also tried to reduce the height of the Navigation bar with this:

override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)
    let height: CGFloat = 20 //whatever height you want
    let bounds = self.navigationController!.navigationBar.bounds
    self.navigationController?.navigationBar.frame = CGRect(x: 0, y: 0, width: bounds.width, height: bounds.height + height)

}

But that did not do anything.

top layout guide problem

I am tapping in the dark. Can anybody explain why the text is outside my Navigationcontroller titlebar??

kangarooChris
  • 718
  • 1
  • 10
  • 21
  • Why are you setting the navbar's frame? – rmaddy Jun 27 '17 at 23:49
  • You are right, probably not doing anything to solve the problem . The real question is what that light blue area is - is it the top layout area? Why is the text of the Nav bar there??? – kangarooChris Jun 28 '17 at 03:46

0 Answers0