ios - Tableview not going bigger if expanding cell -
i've implemented thing click on cell or button , tableview cell expand. problem if expand last cell behind tableview. how can make resize tableview , move cell little?
i made constraints , views inside cell.
it looks this, blue 1 main 1 , black going expand.
i don't know code necessray how make expand.
this inside cellforrowatindexpath:
if (self.selectedindex == indexpath.row){ self.selectedindex = -1 }else{ self.selectedindex = indexpath.row } self.productstable.beginupdates() self.productstable.reloadrowsatindexpaths([indexpath], withrowanimation: uitableviewrowanimation.automatic) self.productstable.endupdates() } return cell this inside heightforrowatindexpath:
if(selectedindex == indexpath.row){ return 210 }else{ return 135 } i tried detect last cell , move not working.
check code
func reloadchange() { let indexpath = nsindexpath(forrow: selectedindex, insection: 0) self.tableview.reloadrowsatindexpaths([indexpath], withrowanimation: uitableviewrowanimation.none) //this way scroll last cell self.tableview.scrolltorowatindexpath(indexpath, atscrollposition: .bottom, animated: true) } func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) { //code expand , shrink cell if(self.selectedindex == indexpath.row) { self.selectedindex = -1 self.tableview.reloadrowsatindexpaths([indexpath], withrowanimation: uitableviewrowanimation.none) //this way scroll last cell self.tableview.scrolltorowatindexpath(indexpath, atscrollposition: .bottom, animated: true) return } self.selectedindex = indexpath.row self.reloadchange() } i hope helps

Comments
Post a Comment