swift - multiple UITableViewCells in multiple UITableViews -
i have few uitableviews each (rather complex) custom cells. of custom cells same however. example make things clear
tableview1 has customcell1, customcell2 tableview2 has customcell3, customcell2 tableview3 has customcell1, customcell3 ...
i can create classes customcells inheriting uitableviewcell. can control-drag labels/imageviews customcell1 tableview1 class create outlets. how create customcell1 in tableview3 , connect outlets ?
i think best option extract cells in separate xibs, load xibs inside viewdidload()
, register them each uitableview
.
so, after extracting cells, connect outlets each class particular cells, , use following:
var nib1 = uinib(nibname: "customcell1", bundle:nil) tableview1.registernib(nib1, forcellreuseidentifier: "customcell1")
and on, each cell , each tableview.
after can dequeue these cells in cellforrowatindexpath
method. here, can set values each ui element , reuse them on every tableview need.
Comments
Post a Comment