1

I have a tableview with UiTableViewCells from a XIB and I want to animate a change of cell height when selected and showing/hiding some elements. Now, for the animated change of height there's no problems, I've done it with the tutorial in this answer . The problem is how to toggle some elements! I can't figure out how to solve this problem! Putting on the xib the elements, they cover the cell above; by code I can't find a method to call when a cell is opened and the animation i finished! Any ideas?

Thanks to all!

Community
  • 1
  • 1
Kiavor
  • 476
  • 1
  • 7
  • 14

1 Answers1

0

There may be an easier way than this, but one way would be instead of changing the cell height and adding the new components in the animation block, set a flag for that row that it should be expanded then in your animation block call

[tableview reloadData]

And in your

heightForRowAtIndexPath 

method return the new cell height and in the

cellForRowAtIndexPath 

method of your delegate return the new version of the cell with the additional elements.

gamozzii
  • 3,911
  • 1
  • 30
  • 34
  • Yes, but with this method I lose the "beauty" of the animated change! – Kiavor Oct 26 '11 at 14:41
  • I think you should still be able to put the code above inside an animation block and thus get the animated effect (maybe? ... tbh I haven't tried it - I've used the above technique to adjust and expand cell sizes/content but not tried to put it in an animation block). – gamozzii Oct 27 '11 at 00:17