woutr_be woutr_be - 13 days ago 5
iOS Question

Settings the title from inside a UITableView

I'm working on a simple application with 3 tabs at the moment, the first tab is a UITableViewController, the other 2 are UIViewControllers.

Now from inside both UIViewControllers, I can set self.title and the title of the navbar will change.
But if I try this from inside the UITableViewController, this doesn't work, why is this?

I'm also trying to set a custom background for the navigation bar, after checking some tutorials, I found that this should work, but it really doesn't

UIImage *image = [UIImage imageNamed:@"bgNavigationBar.png"];
[self.navigationController.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];

Answer
self.navigationItem.title=@"Your Title";

should work, just put it in

- (void)viewDidLoad {
}

of the UITableViewController

Comments