ios - TableViewCell image change when touched -
i have own tableviewcell
class inherit uitableviewcell
. on cell nib file, have put image in tableviewcell
. (the image not occupy whole cell area, there spaces around image)
then, implement touch feedback feature when user touch image in cell, image replaced image.
i tried in tableview:didselectrowatindexpath:
method :
- (void) tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { //my tableviewcell uitableviewcell *cell = [tableview cellforrowatindexpath:indexpath]; //new image replace current 1 uiimage* bg = [cctheme imagenamed:@"green_btn_bg"]; uiimageview* bgview = [[uiimageview alloc] initwithimage:bg]; cell.selectedbackgroundview = bgview; ...
but not work @ all. so, how can implement touch feedback feature?? that's when user finger touched image in cell, image changed one.
create uiimageview
property in custom uitableviewcell
class iboutlet
set image on property cellforrowatindexpath:
rather background property.
cell.yourcustomimageview.image = bgview;
or add uiimageview current generic uitableviewcell below.
with current cell
[cell addsubview:bgview];