iPhone dev: UIBarButtonItem or title not showing up in NavigationBar
- by IceMan85
Hello everyone,
here my problem. I have a NavigationBar at the top, a TabBar at the bottom and a TableView at the center of the screen. Very normal situation. I set it all up in IB and I have set this in the app delegate :
ExpensesListNavController *expensesListNavController;
This in order to be able to add new views to the stack. I need to have 3 levels:
- list of items in a TableView - OK
- firstLevel: once pressed one cell a view is added to the stack - OK
- second level: one pressed the "modify" button on the navBar on the firstLevel I want to show a new view that can be customized by the user.
My Problem is coming when trying to add the "Modify" button in the "firstLevelView". Here-below my code
-(IBAction) modify:(id)sender
{
if (editableDetailViewController == nil)
{
editableDetailViewController = [[editableDetailViewController alloc] init];
}
editableDetailViewController.expense = expense;
[appDelegate.expensesListNavController pushViewController:editableDetailViewController animated:YES];
editableDetailViewController = nil;
}
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
appDelegate = [[UIApplication sharedApplication] delegate];
UIBarButtonItem *modifyButton = [[UIBarButtonItem alloc] initWithTitle:@"Modify" style:UIBarButtonItemStylePlain target:self action:@selector(modify:)];
appDelegate.expensesListNavController.navigationItem.rightBarButtonItem = modifyButton;
appDelegate.expensesListNavController.navigationItem.title = @"Titoloooo";
NSLog(@"NavBar button has just been set !!");
[modifyButton release];
Nothing is being showed, neither title nor the button. Do you have any idea of what is happening ?? I really cannot figure out !!!
Thanks a lot in advance, AM