Legolas
Legolas

Reputation: 12325

UINavigationItem on the UINavigationController

So I created a UINavigationBar and set it up as an outlet in the .h and .m files. I also connected them in the interface builder. It is working fine.

I need to set a label to the Navigation Bar, and I understand that I need to setup an UINavigationItem for this work. I had setup outlets for the UINavigationItem and connected them via the user interface. It is not appearing when I build and run it.

Am I missing something ? Or do I just need to create an UILabel and place it over the Navigation Bar ?

Upvotes: 0

Views: 1118

Answers (1)

Amy Worrall
Amy Worrall

Reputation: 16337

Try using the navigation item's title property for this:

UINavigationItem *item = [[[UINavigationItem alloc] initWithTitle:@"Login"] autorelease];
[yourNavigationBar pushNavigationItem:item animated:NO];

Upvotes: 3

Related Questions