Set the title of Navigation Bar created in Interface Builder
UINavigationBars
manage a stack of UINavigationItems
much like a UINavigationController
manager a stack of UIViewControllers.
To set what is visible directly, you should use either
pushNavigationItem:animated:
or setItems:animated:
using the navigationItem of the view controller you want the bar to
reflect.
eg:
self.navigationItem.title
= @"A custom title";
[self.navigationBar
pushNavigationItem:self.navigationItem animated:NO];
The
above code that you have a property navigationBar
which references the stand-alone navigation bar.
If
you don't want to manage it yourself, you can do as mplappert
suggested and nest your view controller (witout a stand-alone
UINavigationBar)
in a UINavigationController
and present the navigation controller modally instead of your view
controller.
or
self.navigationBar.topItem.title = title;
where navigation bar is your outlet.
Regards
Tejaswini.S
No comments:
Post a Comment