Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reuse cell from another table VC in same storyboard [duplicate]

Lets say in storyboard I have two table view controllers (A and B). In the A controller I did create cell prototypes with identifiers: VIENS and DU. In the B controller I need to use cell with identifier DU. I do not want to create same look and feel cell prototype in the B controller once again. Is here a way to reuse cell DU from A controller in the B controller? If yes then how to do it?

like image 960
Ramis Avatar asked Oct 13 '14 14:10

Ramis


1 Answers

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

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

Check my question here...

UITableView registerNib:forCellReuseIdentifier:

It isn't a duplicate question but it will show you how to define and register the nib.

like image 129
Fogmeister Avatar answered Oct 19 '22 19:10

Fogmeister