modal UIViewController title not showing
Hi,
I have a UIViewController object which is being presented as a modal view, but I am unable to set the view title. I want the title to vary depending on the context. I have tried the following:
- (void) viewWillAppear:(BOOL)animated {
self.title = (category ? category.name : @"Add New Category");
}
I have also tried:
- (void) viewWillAppear:(BOOL)animated {
self.navigationController.title = (category ? category.name : @"Add New Category");
}
neither of the above display any title.
If I set a constant title in the NIB file entry for the view controller in Interface Builder then it displays the title, but I need to be able to set it programmatically.
I can set the title for a view using the first example above on a view controller that is pushed onto the navigation controller's stack and that displays correctly, but it won't do it when presenting the view as a modal view.
Can anyone tell me what I need to do, please.
|