Reputation: 1686
I have a navigation controller. The controller works well and shows me the back button for go back to the window. But when I add this code for add the close button:
- (void)viewDidLoad
{
[super viewDidLoad];
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:@"Chiudi"
style:UIBarButtonItemStylePlain target:self
action:@selector(dismissModalViewControllerAnimated:)];
self.navigationItem.rightBarButtonItem = doneButton;
[doneButton release];
}
...then the back button disappears, and I can only see the close button. Why?
Upvotes: 3
Views: 4908
Reputation: 1686
THE PROBLEM was in
dismissModalViewControllerAnimated
I HAD TO USE
[self.navigationController dismissModalViewControllerAnimated:YES];
[self.navigationController popToRootViewControllerAnimated:NO];
Upvotes: 2