ios - UITableViewCell edit cell content on click -
i have question uitableviewcell
's.
i have implemented uitableviewdelegate
method
- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { uitableviewcell *cell = [self tableview:tableview cellforrowatindexpath:indexpath]; cell.backgroundcolor = [uicolor redcolor]; cell.textlabel.textcolor = [uicolor redcolor]; cell.textlabel.text = @"title"; }
after click on desired cell, nothing happens...
why doesn't work expected? also, should make work?
try this:
- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { uitableviewcell *cell = [tableview cellforrowatindexpath:indexpath]; // config selected cell .... }
you should ask uitableview
cell directly rather ask delegate (self
in code). cause delegate may dequeue or create fresh cell rather giving cell seleceted.
Comments
Post a Comment