Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableView edit mode shifting of cell

I have an UITableView with a custom cell and a custom button for the entering the edit mode as well as a custom accessory button. Everything is working but I want the UIImageView with two other UILabels adjacent to it within the cell to be at its X position but only want the "ADD QTY" UILabel to shift its X position to make room for the accessory button.

Tableview upon entering edit mode.

like image 492
Arjun Busani Avatar asked Feb 14 '23 09:02

Arjun Busani


1 Answers

If you don't want the contents of the UITableViewCell to shift, implement the method

- tableView:shouldIndentWhileEditingRowAtIndexPath:

and make it return NO. This method is a part of UITableViewDelegate.


To make the ADD QTY move left, you will need to make a custom animation, I think. Animate the label for ADD QTY in this method

- tableView:willBeginEditingRowAtIndexPath:

There is a similar question here. Check it out and tell me if it works. Cheers!

like image 82
aksh1t Avatar answered Feb 16 '23 03:02

aksh1t