iphone - UITableView Reuse issues -


this cellforrowatindexpath code:

-(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath{     static nsstring *cellidentifier = @"monthviewpopupcell";      uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier];      if (cell == nil) {         nsarray *nibobjcet = [[nsbundle mainbundle] loadnibnamed:@"monthviewpopupcell" owner:self options:nil];         cell = [nibobjcet objectatindex:0];          celltitle.font = [uifont fontwithname:fontb size:size4];         cellsubtitle.font = [uifont fontwithname:fontr size:size4];     }      if (indexpath.row == 0) {         celltitle.text = @"11:03";     }      return cell; } 

for reason don't understand, tableview reuses custom cell wrongly. thought code make first cell show 11:03 , rest show me 10:00 (as in xib file), other cells show 11:03 well, , position changing when scroll , down crazy...

can show me i've done wrong?

thanks

it doesn't reuse same cell in same position, takes cell stored in memory , reuse table in position, need set text of every time, example:

    if (cell == nil) {         nsarray *nibobjcet = [[nsbundle mainbundle] loadnibnamed:@"monthviewpopupcell" owner:self options:nil];         cell = [nibobjcet objectatindex:0];          celltitle.font = [uifont fontwithname:fontb size:size4];         cellsubtitle.font = [uifont fontwithname:fontr size:size4];     }      if (indexpath.row == 0) {         celltitle.text = @"11:03";     }     else{         celltitle.text = @"10:00";     } 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -