Adding UIBarButtonItem to UINav..Controller

Posted by mlecho on Stack Overflow See other posts from Stack Overflow or by mlecho
Published on 2010-03-26T02:55:43Z Indexed on 2010/03/26 3:03 UTC
Read the original article Hit count: 462

i am not sure what i am missing here. I Have a custom UINavigationController and i am trying to add a persistant UIBarButtonItem to the bar.

-(void)viewDidLoad
{
 self.navigationBar.barStyle = UIBarStyleBlack;
 UIBarButtonItem *bbi = [[UIBarButtonItem alloc] initWithTitle:@"Nope..."
               style:UIBarButtonItemStyleBordered
                 target:self
                 action:@selector(goBack:)]; 
 self.navigationItem.leftBarButtonItem =bbi;
    [bbi release]; 
}
-(void)goBack:(id)sender
{
 NSLog(@"go back now");
}

what am i missing here? - BTW, i do not want to/ will not use IB.

© Stack Overflow or respective owner

Related posts about uibarbuttonitem

Related posts about uinavigationcontroller