I have a grouped UITableView and when going into edit mode, the cells indent. I need to stop the cells indenting when going into edit mode.
I have tried two things:
cell.shouldIndentWhileEditing = NO;
and
-(BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath
{
return NO;
}
Neither of these stop cell indentation upon entering edit mode.
Do it the way documentation suggests, quoting [UITableViewCell willTransitionToState:]
:
Subclasses of UITableViewCell can implement this method to animate additional changes to a cell when it is changing state. UITableViewCell calls this method whenever a cell transitions between states, such as from a normal state (the default) to editing mode. The custom cell can set up and position any new views that appear with the new state. The cell then receives a layoutSubviews message (UIView) in which it can position these new views in their final locations for the new state. Subclasses must always call super when overriding this method.
In other words, you can change the position and size of the [UITableViewCell contentView]
in [UITableViewCell layoutSubviews
, to cancel the indendation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With