I have a simple grouped table view that when a cell is selected it pushes a View controller. The navigation bar’s left item puts the table view in “editing mode.” In editing mode you can move and delete each cell as wanted. What I want is to be able to push a separate View controller when it is editing mode then when it is in normal mode.
This is where the View Controller is being pushed:
- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
...stuff that doesnt matter...
[[self navigationController] pushViewController:detailViewController animated:YES];
}
The BarButtonItems are being declared here:
[[self navigationItem] setLeftBarButtonItem:[self editButtonItem]];
This is where all the editing stuff is declared:
- (void)tableView:(UITableView *)atableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete)
{
[atableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation: UITableViewRowAnimationFade];
}
}
- (void)tableView:(UITableView *)atableView
moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath
toIndexPath:(NSIndexPath *)destinationIndexPath
{
[[BNRItemStore sharedStore] moveItemAtIndex:[sourceIndexPath row]
toIndex:[destinationIndexPath row]];
}
When you push your view controller in the didSelectRowAtIndexPath, you can check if the tableview is in editing mode. If it is, you can push a different view controller.
editing is a property that returns YES if the tableview is currently in editing mode.