ios - Changing specific row in table from void -
i have populated tableview change image. when i'm inside cellforrowatindexpath can change using:
cell.imageview.image = [uiimage imagenamed:@"image.png"];   but cannot figure out how same thing inside void, have tried:
[self.tableview cellforrowatindexpath:[nsindexpath indexpathforrow:row insection:0]].imageview.image = [uiimage imagenamed:@"image.png"];   but doesn't change image @ all.
thanks, /dsdeniso
edit:
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = nil; cell = [tableview dequeuereusablecellwithidentifier:cellidentifier];  if (cell == nil) {     cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; } _row = indexpath.row; [self changeimage]; }  - (void)changeimage{ uitableviewcell * cell = [self.tableview cellforrowatindexpath:[nsindexpath indexpathforrow:_row insection:0]]; if(cell) { cell.imageview.image = [uiimage imagenamed:@"image.png"];  } else { nslog( @"why cell null?  did set row properly?"); } }      
just pass cell method
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath     {     static nsstring *cellidentifier = @"cell";     uitableviewcell *cell = nil;     cell = [tableview dequeuereusablecellwithidentifier:cellidentifier];      if (cell == nil)     {         cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier];     }     _row = indexpath.row;     [self changeimageforcell:cell];     }      - (void)changeimageforcell:(uitableviewcell*)cell{     cell.imageview.image = [uiimage imagenamed:@"image.png"];     }      
Comments
Post a Comment