0

I have a table view that has an 'editing' mode and a normal mode. When the cell is in an editing mode, it has different layout constraints. All cells goes into editing mode simultaneously. I want to animate the transition in all cells from non-editing mode to editing mode and vice versa. How can I animate these all simultaneously?

I have seen advice like this: UITableView Edit mode However if I apply that I get my custom editing mode layout PLUS the built in OS editing mode, which I don't want. How can I transition to only my editing layout?

Community
  • 1
  • 1
helloB
  • 3,472
  • 10
  • 40
  • 87

1 Answers1

0

I think the one way to do that is

  • add a variable like isEditing to your VC
  • when a cell goes editing mode - you set isEditing true
  • reload tableview content
  • animate cell in cellForRowAt right after initialization if isEditing is true

Maybe you need to elaborate this considering the editing state not to animate cells newly initiated by scrolling.

Here is the snapshot of the code I quickly put: enter image description here

https://www.dropbox.com/s/1pb166c1mokgf2e/Untitled.mov?dl=0

christian
  • 445
  • 1
  • 3
  • 12
  • Thanks for this tip, but I don't think I follow. When I reload the table view content, the table view content will already immediately appear (unanimated) in the 'editing' mode whereas I want to show a smooth transition. – helloB Jan 09 '17 at 20:50
  • That's why you need to animate your cell manually right after initialization. – christian Jan 09 '17 at 20:51