iphone - how to update a label text inside the tableview cell in ios -


uitableview's cellforrowatindexpath :

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {    static nsstring *cellidentifier = @"cell identifier";    cell = (uitableviewcell*)[tableview dequeuereusablecellwithidentifier: cellidentifier];    if(cell==nil)   {      cell = [[uitableviewcell   alloc]initwithstyle:uitableviewcellstylesubtitle reuseidentifier:cellidentifier];      uilabel *likelabelnew  =  [[uilabel alloc]init];      likelabelnew.frame     =  cgrectmake(230,5,50,20);      likelabelnew.text      =  @"old text";      likelabelnew.tag=indexpath.row;      [cell addsubview:likelabelnew];   }    return cell; } 

add code whereever want update cell text. suppose have update uilabel tag 100 . add 1 more check :

  uitableviewcell *cell = [tableview cellforrowatindexpath:indexpath];   nsarray *subviews = cell.subviews;   (uiview *subview in subviews) {     if ([subview iskindofclass:[uilabel class]] && subview.tag == 100) {       uilabel *mylabel = (uilabel *)subview;       //update lable here     }   } 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -