views:

657

answers:

3

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

+2  A: 

When are you calling that line? I call the same line in the ViewDidLoad method 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];
Jab
I tried both in viewDidLoad and in viewWillAppear. No joy :(
Alan
Did you somehow set it up as an IBOutlet?
Alan
Check the edit, you might need to add more information to your question.
Jab
A: 

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.

craig
A: 

If your reference is nil, check your connections in IB.

Mugunth Kumar