I have a Controller/View for a generic list of items, that can be extended for displaying a custom list.. Listing and navigation works fine.. but I can’t change the title of UINavigationController.
In the generic Controller:
- (void)viewDidLoad
{
[super viewDidLoad];
[self.view addSubview: navigationController.view];
}
- (void)setNavigationTitle: (NSString *)title
{
NSLog(@"set title: %@", title); // this works
self.navigationController.title = title; // Nothing works here
}
Then, the extended class does..
- (void)viewDidLoad
{
[super viewDidLoad];
[self setNavigationTitle: @"Custom list"];
}
The navigationBar still have “Item” as title 🙁
In your
UIViewControllerthere is atitleproperty and it is that property that will be displayed by theNavigationController. So when pushing a newUIViewControlleronto the navigation stack set the title of thatUIViewControllerto whatever is appropriate.In your case it looks like it would be: