Allen
Allen

Reputation: 3771

Prevent UITableView default behavior during edit mode

I have a UITableView controller that allows editing through a button, with allowsMultipleSelectionDuringEditing being set to YES.

During non-editing mode, selecting a cell will bring up a different view with cell specific data. What would be the best way to disable this during edit mode, as well as bring up an action sheet at the bottom of the screen?

Upvotes: 1

Views: 134

Answers (2)

Allen
Allen

Reputation: 3771

I found out tableView has a handy "isEditing" property:

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

    if(self.tableView.isEditing) {
        //instantiate action sheet
    } else {
        //instantiate view
    }
}

Upvotes: 1

iPatel
iPatel

Reputation: 47049

Try with following code

for (UIView* subview in [self subviews])
{
  if (![NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellEditControl"])
  {
     // create/Initialize your detailView's object

  }
  else
  {
    //create your action sheet;
  }
}

This code write in didSelectRowAtIndexPath Method

Upvotes: 1

Related Questions