How to add Button in UINavigationController

Posted by Ali on Stack Overflow See other posts from Stack Overflow or by Ali
Published on 2011-01-03T06:55:35Z Indexed on 2011/01/04 11:53 UTC
Read the original article Hit count: 416

Hi all ,

navigator=[[UINavigationController alloc]initWithRootViewController:contacts];

UIBarButtonItem *nextButton = [[UIBarButtonItem alloc]
       initWithTitle:@"Delete"
       style:UIBarButtonItemStyleBordered
       target:self
       action:@selector(makeCall)];

//[[self.navigator navigationItem] setLeftBarButtonItem:nextButton];
self.navigator.navigationBar.items=[NSArray arrayWithObject:nextButton];

I am adding a button to UINavigationController and got following exception please help me

2011-01-03 11:46:26.626 Appointment[2243:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Cannot call setItems:animated: directly on a UINavigationBar managed by a controller.'
2011-01-03 11:46:26.634 Appointment[2243:207] Stack: (
3040

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocoa-touch