I'm working with the Xcode Utility template. In rootViewController.m there's a section that sets up the navbar for what's called the FlipSideView:
(snip)
UINavigationItem *navigationItem = [[UINavigationItem alloc] initWithTitle:@"Title"];
(snip)
How can you programatically change the navbar title from within the FlipsideViewController class? I tried:
self.navigationItem.title = @"XXXXXX"; w/o success.
Thanks
-
When are you calling that line? I call the same line in the
ViewDidLoadmethod and it works fine.- (void)viewDidLoad { self.navigationItem.title = @"Test"; [super viewDidLoad]; }How are you showing your view? Here is how one of my ViewControllers(tableView) presents the other(detailView)
[self.navigationController pushViewController:detailController animated:YES];Alan : I tried both in viewDidLoad and in viewWillAppear. No joy :(Alan : Did you somehow set it up as an IBOutlet?Jab : Check the edit, you might need to add more information to your question. -
Jesse's answer should work, but since you're still having troubles, one of the first spots to check is the reference to the navigationItem.
Try debugging your app with a breakpoint on that line, and examine the reference. Most likely, the call is not taking place because the reference is nil.
-
If your reference is nil, check your connections in IB.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.