I'm facing some problems in implementing a tableview, with "Back", "Edit" and "Add" buttons on the navigation bar. The tableview is reached by clicking on a row of another tableview, so the "Back" button is added automatically. With the storyboard I've added the "Add" button to the navigation bar. With code I've added the "Edit" button (I used code, since if I add the button with the storyboard, I don't know how to reproduce the "Edit" standard behavior...):
self.navigationItem.leftBarButtonItem = self.editButtonItem;
The problem is that, in this way, the "Edit" button hides the "Back" button on the navigation bar.
At this point, I've two questions:
- Is it possible with storyboard to add a third button on the navigation bar?
In case I've to do this programmatically, I know that I can do this as follows:
UIButton *button = [UIButton buttonWithType: UIButtonTypeRoundedRect]; [button setFrame:CGRectMake(width-90,6,50,30)]; [button setTitle:@"Edit" forState:UIControlStateNormal]; button.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; [self.navigationController.navigationBar addSubview:button];
But how can I implement via code the standard behavior of the "Edit" button? I mean, I click "Edit" and the button becomes "Done" and the rows become deletable...
Thanks in advance, yassa