0

In a tabbed application, is it possible to have a navigation bar WITHOUT having to use an entire UINavigationController as a UIViewController? I simply need a navigation bar to position an icon on the right (it should simply open a modal). Of course, I could "fake" it with a UIView, but it's not very elegant.

Tamás Sengel
  • 55,884
  • 29
  • 169
  • 223

1 Answers1

2

This is possible with a UINavigationBar placed on the top of a view controller.

It is possible to create one from the storyboard, too. Look for the "Navigation Bar" element in the IB Inspector.

Navigation Bar in inspector

This will behave just like a navigation controler's nav bar, with the exception of the navigation functions.

Tamás Sengel
  • 55,884
  • 29
  • 169
  • 223
  • I did it, but the strange thing is I can't position it without causing one of the following issues: too much space above that causes to show the background of the main view OR too near to other top elements –  Aug 01 '17 at 14:33
  • (the UINavigationBehavior is different, the navigation element extents itself till the top border) –  Aug 01 '17 at 14:37
  • 1
    You can easily place a `UIView` there to cover the status bar, or you can refer to this question for more information: https://stackoverflow.com/questions/18948505/uinavigationbar-status-bar-issue-in-ios7 – Tamás Sengel Aug 01 '17 at 14:38
  • For the record, I solved using the solution by matt here: https://stackoverflow.com/questions/32142375/changing-the-height-of-the-navigation-bar-ios-swift –  Aug 01 '17 at 15:17