ios - Swift create instance of custom cell before loading the tableView? -
i've run issue. have created dynamic tableview 2 prototype cells. if imagine instagram profile. has information user , underneath has feed of posts. recreated ui making tableview 2 cells, 1 profile part thats first cell, cells after generated each post have made. problem lot of logic of loading user's information first cell in viewdidload , viewwillappear of viewcontroller, not custom cell class.
therefore, trouble having sharing outlets custom cell class view. want able access outlets custom cell , give them title, text, color, etc. before loading table. there anyway this? how preload custom cell? wish make cell non-reusable can connect outlets viewcontroller , avoid "outlets cannot connected repeating content" error. first cell not repeating content specific user loads page. idk do, suggestions? tried making first cell view(not table cell) above posts table repeating cells not scroll 1 on page.
i lot of logic of loading user's information first cell in viewdidload , viewwillappear of viewcontroller, not custom cell class.
that's fine.
i want able access outlets custom cell , give them title, text, color, etc. before loading table
but there's no need. look, you're confusing pieces of mvc - model, view, controller. custom cell view. doing here setting interface, , there's no delay, no harm, no confusion in doing in cellforrowatindexpath:
every cell.
as getting information ready beforehand, that's fine - model. free time, , wish way in advance reasonable.
but handing on model information view, controller, , table view, moment cellforrowatindexpath:
. don't worry, happy. don't have preload anything.
now, if question how refer bits of interface in cell when you're in cellforrowatindexpath:
, there lots of ways, such tag numbers, or outlet names (using custom cell class). that's minor implementation detail. question architectural, , architecturally, you're doing fine.
Comments
Post a Comment