2

I have a UIViewController embedded in a UINavigationController. I'm trying to make its navigation bar the same height as the rest of my views which have a navigation bar I dragged in (they're not embedded in a UINavigationController).

However, when I add a title and a prompt like I do for the rest this one ends up taller than the rest. Here's a picture of what I mean:

nav

The left is a UIViewController not embedded in a UINavigationController, while the right one is a UIViewController embedded in a UINavigationController. Both have a title and a prompt set to " ".

This is driving me crazy, can anybody help me get the one on the right to be the same height as the one on the left? When I delete its prompt it becomes too short.

Edit

The navigation on the left has a height of 74, it's just a dragged in navigation bar with a title and a prompt set to " ". From what I've gathered it is pretty much impossible to get it to be like this in an embedded navigation bar. When I add a prompt on the right its too tall as seen in the picture, when I remove it its too short.

aircraft
  • 25,146
  • 28
  • 91
  • 166
MarksCode
  • 8,074
  • 15
  • 64
  • 133
  • How about if instead of using title & prompt - you use custom view in the titleView of the navigationBar and place two labels there? – Cherpak Evgeny Apr 15 '17 at 09:57

1 Answers1

1

You have a blank prompt text set. That makes your food total height 74, but if you use the navcontroller with status bar it will be 64 total height.

enter image description here Bottom image is 74 px high total, thats a viewcontroller with Top Bar None and an embedded navbar with blank prompt. This will not be possible to obtain in a standard nav with VC setup, if you want it you have to alter the navbar height manually.

I usually just embed all VCs in a root navcontroller, i suggest you do that for your food VC as well. Then you will get the same height, but it will be 64 though

bogen
  • 9,954
  • 9
  • 50
  • 89
  • So can you embed the food VC in a navcontroller? You won't get 74 height in a navigationcontroller embed, if you want that you have to alter the navigation bar height yourself, for example here: http://stackoverflow.com/questions/894985/change-uinavigationbar-height – bogen Apr 13 '17 at 06:40
  • I was hoping to have the embedded VC (one on the right) to have the same height as the non-embedded one which has a height of 74px. – MarksCode Apr 13 '17 at 06:42
  • Yep, its not possible with the standard way of embedding nav with vc, it can be done, but you then have to alter the height runtime. My final recommendation is to use the 64 height everywhere – bogen Apr 13 '17 at 06:50