質問

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?

役に立ちましたか?

解決

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];
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top