views:

62

answers:

1

I have a UITableView that is editable. I am commiting changes via:

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath

While in edit mode, I would like the user to be able to select a row, which will push a new view. I am not sure how to do this. I suspect it will be in:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

But how can I determine if the user is in edit mode or not?

UPDATE: Edit Mode is toggled via:

self.navigationItem.rightBarButtonItem = self.editButtonItem;
A: 

To allow selection during editing you need to set the allowsSelectionDuringEditing property of UITableView to YES. Then it will call the didSelectRowAtIndexPath message. You can find more information about that property here:

http://developer.apple.com/iphone/library/documentation/uikit/reference/UITableView_Class/Reference/Reference.html#//apple_ref/occ/instp/UITableView/allowsSelectionDuringEditing

Then, you can see if the user is in edit mode by running code like the following:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (tableView.editing == YES) {
        // Table view is editing - run code here
    }
}
rickharrison