uitableview - iOS Swift dequeueReusableCellWithIdentifier causing overlap -


this has been driving me mad, have @ every post on around in regard this.

i using custom tableview cell classes , xib files. works fine, until scroll table view off screen (that old chestnut). know has dequeuereusablecellwithidentifier method , not clearing old data. have no idea how implement this.

once cell scrolls off screen., causes overlap , continues add images cell.

let cell: detailheadertableviewcell = tableview.dequeuereusablecellwithidentifier("detailheadertableviewcell") detailheadertableviewcell 

from have found, need implement this:

uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:nil];  uiimageview *defaultimageview; uilabel *customlabel;  if (cell == nil) {     // create cell , empty views ready take content.     cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstylesubtitle reuseidentifier:cellidentifier]; } else { ... } 

however cannot work out how achieve in swift.

many in advance.

what you're looking uitableviewcell's prepareforreuse method.

if you're using custom uitableview cells, need implment method clear out old data cells before reused.


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -