0

I have a tableviewController and with 5 prototype row. Generally all of them have these objects in vertically order:

Label - A

Label - B

Others objects (Label, progress bar, images)

As example, row 1 has Label A then below Label B, then below others 2 labels.

What I'm trying to achieve is to have all the rows with the same height that show only the first two labels (A and B) and then when tapping it expand showing the rest of the objects, tap again it collapse.

NiBE
  • 857
  • 2
  • 16
  • 39
  • 1
    [this](http://stackoverflow.com/questions/460014/can-you-animate-a-height-change-on-a-uitableviewcell-when-selected) might get you on the right track – Bienemann Jul 28 '16 at 13:22
  • It sounds good, I can reduce the cell, but the objects then reduce themselves due the new height, while I'd like to keep as they were – NiBE Jul 28 '16 at 15:08
  • What about unchecking "Autoresize Subviews" and checking "Clip Subviews" in your prototype cells? – Bienemann Jul 28 '16 at 15:13
  • @Bienemann I put suggested constraints in my prototype cells and everything look great, but once I collapse the view all the objects resize as well. I set what you suggest nothing changes, If I remove the constraints it works even if it's not feasible . have you other precious advice? – NiBE Jul 28 '16 at 17:27
  • I'm at work right now so I don't have time implement and test it, but sounds like you could have a UIView "container" wrapping around the elements you don't want to resize, set those inner element's constraints in relation to that container, and then set the container's constraints in relation to the CellView accordingly. That way the elements won't depend on the cell's size. – Bienemann Jul 28 '16 at 19:20
  • Since the requirement is to arrange the objects vertically, why not use 5 sections instead of 5 rows and assign rows for each of the objects. Initially, there will only be 2 rows and on receiving click on those you could return the number of rows to meet your requirement. It seems the most convenient way to do it right? – Feby Sam Aug 01 '16 at 01:50

0 Answers0