Reusing a cell from another VC table in the same storyboard

Say, in a storyboard, I have two table view controllers (A and B). In controller A, I prototype cells with identifiers: VIENS and DU. In controller B, I need to use a cell with a DU identifier. I don’t want to create the same prototype of the control in controller B. Is there a way to reuse the DU cell from controller A in controller B? If so, how to do it?

+5
source share
1 answer

The best way to do this is to not define a cell in the storyboard at all.

Create a separate NIB file and define a UITableViewCell there. Then you can register the tip with the table and load it from there. Now you have only one copy of the cell definition, but it can be used in several places.

Check out my question here ...

UITableView registerNib: forCellReuseIdentifier:

This is not a duplicate question, but it will show you how to identify and register nib.

+17
source

Source: https://habr.com/ru/post/1204565/


All Articles