Positioning a UINavigationBar

I have a UIViewController and I've placed a UINavigationBar inside of it but I can't figure out how to properly position it. It won't let me resize it vertically and if I place it too high it won't look a regular navigation bar.


Below is an example of how I have the navigation bar set now just to look as normal as possible. But you can see it's not sized right.


Any ideas? Thanks!


No, we cannot see, images are not available on the forum ! What is not sized right ?


You cannot resize vertically but you can position it where you want ; set constraints to have it properly displayed.

Ugh. I love how you can't post a photo in an Interface Builder forum.


I placed the navigation bar so the bottom of the bar is about where the standard navigation bar sits. But the top of the navigation bar is quite a bit lower than a standard navigation bar and doesn't fill up the space.


It sounds like if I place constraints the navigation bar will stretch itself to the top like a normal standard navigation bar?

Yes it is a pity we cannot post screenshots !


Does it work now ? If so, thanks to mark the thread as closed.


If not, you should try to draw in text what you have (like we did some 30 years ago before someone invented Macintosh 😁 ; probably not the same who designed this forum)


________________________________

| |

| ---------------------------------------------------|

| Navigation bar |

|_______________________________|


Not obvious !

I'm away from my office at the moment. I'll have to give it a shot later and see.


Thanks!

So I've applied some constraints and the navigation bar is still not filling up the space above it.


  • Navigation Bar.leading = leading
  • Navigation Bar.top = Top Layout Guide.bottom + 8
  • trailing = Navigation Bar.trailing


I wish I could post a picture to show what I mean but the navigation bar simply isn't filling up the space of a standard navigation bar. I feel like implementing such a standard UI element would be easy as pie but I'm not having any luck.

Why not simply:

Navigation Bar.top = Top Layout Guide.bottom

Positioning a UINavigationBar
 
 
Q