ios - Should I use dequeReusableCellWithIdentifier? -
i know question dumb. got stuck question.
when use dequereusablecellwithidentifier, cells reused. more specific, first 'n' set of cells reused - along references
as same references reused, can't store local variables cells. need assign them everytime in cellforrowatindexpath
assume i'm using custom complex uitableviewcell. (i know should reduce complexity. still...)
some views added cell.
best example think of image slider.
so number of images in image slider differs based on datasource. need add views in cellforrowatindexpath. can't avoid it.
since same reference of cells reused, need add these views everytime cellforrowatindexpath called. think bit of heavy load.
i thought of using drawrect method, not work uitableviewautomaticdimension
if don't use dequereusablecell, have individual referenced cells, cost memory , performance.
so best solution? can use dequereusablecell , still need not rewrite content?
edit 1: mentioning dequereusablecell, did mention dequeuereusablecellwithidentifier - forindexpath. i'm sorry confusion.
edit 2: i feel, i'm not clear in question.
lets consider have array in viewcontroller. i'm configuring cell in cellforrowatindexpath dequeuereusablecellwithidentifier - forindexpath
so happens is, everytime scroll, when invisible rows become visible, cellforrowatindexpath called.
lets have image slider n imageviews. each cell, 'n' differs. i'm forced draw cell's view based on datasource.
so everytime tableview calls cellforrowatindexpath, cell configured again , again.
i want avoid improve performance.
what in case following:
- i use
dequereusablecell:
, reasons said - i write
cleancell
method in customuitableviewcell
class in order clean has been set on cell (just make ready reuse) - then in
cellforrowatindexpath:
configure cell desired
Comments
Post a Comment