I want to prevent content of table cells from shifting to the left side when using table editing mode. I implemented the following UITableViewDelegate
method in my view controller:
- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath {
return NO;
}
as suggested in:
Prevent indentation of UITableViewCell (contentView) while editing
But it doesn't seem to be ever called. This didn't work either:
cell.shouldIndentWhileEditing = NO;
I'm using a couple of custom edit row actions that are defined like this:
- (NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView
editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
NSMutableArray<UITableViewRowAction *> *actions = [NSMutableArray array];
id clearHandler = ^(UITableViewRowAction *action, NSIndexPath *indexPath) {
...
};
UITableViewRowAction *clearAction = [UITableViewRowAction
rowActionWithStyle:UITableViewRowActionStyleDestructive
title:@"Clear\nStatus"
handler:clearHandler];
[actions addObject:clearAction];
id editHandler = ^(UITableViewRowAction *action, NSIndexPath *indexPath) {
...
};
UITableViewRowAction *editAction = [UITableViewRowAction
rowActionWithStyle:UITableViewRowActionStyleNormal
title:@"Edit"
handler:editHandler];
[actions addObject:editAction];
return actions;
}
I double checked that the delegate
property of the table view is pointing to the view controller. What else am I missing?
Table view style is not grouped, i.e. plain.