0
votes

I want to display a Navigationbar without using a UINavigationController. The Navigationbar should show a button on the left side and a Title in the center.
I already tried to do it like this but that don't work: Add items to NavigationBar (Not using UINavigationController)
There is also a comment in the official documentation that i should not use this property if I don't use a navigation controller: https://developer.apple.com/library/ios/documentation/uikit/reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/navigationItem
Is this even possible and if not how could I get a similar result?

1
Yes, it's very possible. Are you trying to do this programmatically?Lyndsey Scott
Why not use UINavigationController? You can just add one view controller to it.nielsbot

1 Answers

3
votes

It's not super intuitive but you can make this happen.

The answer you linked covers half of the solution (Creating a UINavigationBar and adding a UINavigationItem to it).

You also need to actually add the navigation bar as a subview to your view.

[self.view addSubview:myNavigationBar];