uitableview - UItableViewCell not dequeing properly ios -
using uitableview , found cells not dequeuing properly. here code have written.i have read that, have override prepareforreuse, how use method, not getting. please me out.
  - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     static nsstring *cellidentifier = @"cell";     cell= [tableview dequeuereusablecellwithidentifier:cellidentifier];     if (cell==nil) {     cell=[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier];    }     textlabel = (uilabel*)[cell viewwithtag:11];     textlabel.font=[uifont fontwithname:@"myunderwood" size:16];     textlabel.text = [_tablelabelarray objectatindex:indexpath.row];  return cell;   } here image of uitableview getting when scroll tableview
i not sure if fix issue, code uses local uicell * variable, uses self.tablelabelarray rather accessing property ivar directly , uses textlabel property rather searching tag.
my suspicion cell variable ivar, not local may causing problems, , therefore may help, need font size smaller 16, have specified adjustsfontsizetofitwidth=yes
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {   static nsstring *cellidentifier = @"cell";   uitableviewcell *returncell= [tableview dequeuereusablecellwithidentifier:cellidentifier];   if (returncell==nil) {     returncell=[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier];  }  returncell.textlabel.font=[uifont fontwithname:@"myunderwood" size:16];  returncell.adjustsfontsizetofitwidth=yes;  returncell.text = [self.tablelabelarray objectatindex:indexpath.row];   return returncell; } 
Comments
Post a Comment