When setting [self.tableView setEditing:TRUE];
on a tableView the native table delete editing icons appear to the left. But when using a plain styled table these round icons pushes my row background (and content) to the right.
How can I prevent the editing style from changing my cell position, and instead put the icon on top off the cell?
The way it is now it looks like a bug.
Another question on this. Is there some way to define indexPath.row == 0
to not have an delete icon on setEditing:TRUE
?
shouldIndentWhileEditing
property to NO
.Implement delegate's tableView:editingStyleForRowAtIndexPath:
method and return appropriate value from it, e.g.:
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.row == 0)
return UITableViewCellEditingStyleNone;
return UITableViewCellEditingStyleDelete;
}
Ok, found why #1 was not working. I hade set my row background as a view on cell.contentView, in stead of putting it on cell.backgroundView. This way the built in functionality could not separate background from content.
The shouldIndentWhileEditingRowAtIndexPath function will only prevent background from indenting, and not content, as there has to be room for the editing icon.
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