UICheckBoxTableView.m: fix select/deselect tick boxes

This commit is contained in:
Gautier Pelloux-Prayer 2016-06-13 10:17:44 +02:00
parent aed4593a49
commit 77eddeea7e

View file

@ -54,8 +54,8 @@
_emptyView.hidden = _editButton.enabled = ([self totalNumberOfItems] != 0);
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
- (void)toggleRowSelectionForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
if ([_selectedItems containsObject:indexPath]) {
[_selectedItems removeObject:indexPath];
} else {
@ -65,6 +65,14 @@
[self selectToggleButton:(_selectedItems.count != [self totalNumberOfItems])];
}
- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath {
[self toggleRowSelectionForRowAtIndexPath:indexPath];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[self toggleRowSelectionForRowAtIndexPath:indexPath];
}
- (void)selectToggleButton:(BOOL)select {
_toggleSelectionButton.selected = select;
if (select) {