How to not reuse TableViewCells, but still use prototypes

I have a tableview where a single prototype cell is used only 3 times. This cell has some buttons on it that trigger displaying and hiding content within the cell.

 

I could reuse the cells, but that requires a lot of resetting each cell so that if I expand A’s content, B’s content isn’t expanded when it loads. Furthermore, this requires me to keep a state record in the Controller class, where I would prefer to have this all handled by the Cell itself for modularity. In other words, the amount of work to keep each cell in the correct stage seems inefficient.

 

What would be the best way to go about this? Do I use static cells? Is there a way to instance 3 separate cells of the same type and place them in the TableView?

Powered by WPeMatico

You may also like...

Comments are closed.