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 interfa开发者_开发技巧ce 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 ?
Try using the navigation item's title property for this:
UINavigationItem *item = [[[UINavigationItem alloc] initWithTitle:@"Login"] autorelease];
[yourNavigationBar pushNavigationItem:item animated:NO];
精彩评论