Selectable UITableViewCells when UITableView is in edit mode

The title says it all. I need to make the selection UITableViewCells

possible when the UITableView is in edit mode. I don't think this code is needed here, but in case it is:

-(void)turnEditingOn {
  [self.tableView setEditing:YES animated:YES];
  if (self.tableView.isEditing)
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(newItem)];
  else
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(turnEditingOn)];
}

- (void)viewDidLoad
{
  [super viewDidLoad];
  self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(turnEditingOn)];
  //the rest of the code is omitted
}

      

So I need to be able to make taps on the cells when they are in edit mode, just like the Clock app when you edit alarms.

thank

EDIT

Forgot to mention:

-(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath

      

and

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

      

not called in edit mode

+3


source to share


1 answer


- (void)viewDidLoad {
  [super viewDidLoad];
  self.tableView.allowsSelectionDuringEditing = YES;
}

      



+8


source







All Articles