iPhone dev: UIBarButtonItem or title not showing up in NavigationBar

Posted by IceMan85 on Stack Overflow See other posts from Stack Overflow or by IceMan85
Published on 2010-12-25T21:28:50Z Indexed on 2010/12/26 21:54 UTC
Read the original article Hit count: 219

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

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c