ios - How can i set UITableView cell height programmatically in Swift -


how set view height programmatically have try code

cell.viewmain.frame = cgrectmake(cell.viewmain.frame.origin.x, cell.viewmain.frame.origin.y, cell.viewmain.frame.size.width, 65.0) 

but not working.

update :

func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell {     let cell = tableview.dequeuereusablecellwithidentifier("updatecell", forindexpath: indexpath) as! updatecell      if self.data[indexpath.row] == "b" {         tbupdate.rowheight = 85         cell.viewmain.frame = cgrectmake(cell.viewmain.frame.origin.x, cell.viewmain.frame.origin.y, cell.viewmain.frame.size.width, 65.0)     }else{         tbupdate.rowheight = 220         cell.viewmain.frame = cgrectmake(cell.viewmain.frame.origin.x, cell.viewmain.frame.origin.y, cell.viewmain.frame.size.width, 200.0)     }      return cell } 

first, rowheight changes height of rows in table. if want specific height specific rows, implement tableview:heightforrowatindexpath: method. remove tbupdate.rowheight in code first.


Comments