Я хочу, чтобы иметь возможность выбрать несколько строк, как почта приложения по умолчанию показаны ниже:Невозможно выбрать UITableViewCell когда TableView setEditing установлен
У меня есть кнопка под названием редактирования, который вызывает
[self.myTableView setEditing:YES animated:YES]
кнопка редактирования успешно показывает круги на левой ячейки как почтового приложения, как показано выше. Однако, когда я фактически выбираю одну из строк, ничего не происходит. Красная галочка не появляется в круге, как я ожидал. Почему не появляется красная галочка?
#pragma mark - UITableViewDataSource Methods
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyIdentifier"];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"MyIdentifier"];
}
cell.textLabel.text = @"hey";
return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 3;
}
#pragma mark - UITableViewDelegate Methods
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
return 3;
}
#pragma mark - Private Methods
- (IBAction)editButtonTapped:(id)sender {
if (self.myTableView.editing) {
[self.myTableView setEditing:NO animated:YES];
}
else {
[self.myTableView setEditing:YES animated:YES];
}
}
Спасибо! Это было. Также можно изменить в IB на представлении таблицы (а не на контроллере таблицы) как «Редактирование: одиночный выбор во время редактирования» – jrc