ios - How can I replace selected customTableCellA with customTableCellB -


how can replace selected customtablecella customtablecellb

  • i have table view working customtablecellas
  • i want replace customtablecella customtablecellb when selected.
  • customtablecellb 50 pixels taller customtablecella

how can implement properly?

try this,

create @property array nsmutablearray *selectedindexpatharray , instantiate in viewdidload,

- (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath {     cgfloat cellheight = //customtablecella height     if ([self.selectedindexpatharray containsobject:indexpath]) {          cellheight = //customtablecellb height     } else {          cellheight = //customtablecella height     } }  - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     ...     if ([self.selectedindexpatharray containsobject:indexpath]) {          //load customtablecellb     } else {          //load customtablecella     }     //other code     ... }  - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {     if ([self.selectedindexpatharray containsobject:indexpath]) {          //if want remove selection in second touch,          //[self.selectedindexpatharray removeobject:indexpath];     } else {          [self.selectedindexpatharray addobject:indexpath];     }     [tableview beginupdates];     [tableview reloadrowsatindexpaths:[nsarray arraywithobjects:indexpath, nil] withrowanimation:uitableviewrowanimationnonne];      //select appropriate uitableviewrowanimation     [tableview endupdates]; } 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -