how can change cell height make uilabel fit? not using auto-layout in project.
also, tableviewcell text set in cellforrowatindexpath
.
code:
var commentsarray: [string] = [] override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell:tableviewcell = tableview.dequeuereusablecellwithidentifier("cell", forindexpath: indexpath) as! tableviewcell; if self.commentsarray.count > indexpath.row{ cell.commentstext.text = commentsarray[commentsarray.count - 1 - indexpath.row] cell.commentstext.font = uifont.systemfontofsize(15.0) } return cell }
any ideas?
the above comment of using heightforrowatindexpath acceptable when not using auto layout, (though highly recommend getting used it).
calculating height of label when it's populated string can done using methods described in post: how calculate uilabel height dynamically?
Comments
Post a Comment