我有一个可扩展的tableView,其中当我展开一个部分时,比有三个单元格。在Firth Cell上,只有名字,在第二个单元格中。它有一个很大的内容。现在我想根据内容自动调整此标签的高度和宽度。如何调整自定义tableView中的标签高度和宽度单元格
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tblView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! CustomTableViewCell
let dataArrayTblView = dataArrayForTableView
let titleName = dataArrayTblView.valueForKey("name")
let dueDate = dataArrayTblView.valueForKey("deadlinedate")
let description = dataArrayTblView.valueForKey("description")
cell.titleLabel.text = titleName[indexPath.row] as AnyObject! as! String!
cell.dueDateLabel.text = dueDate[indexPath.row] as? String
cell.descriptionLabel.text = description[indexPath.row] as? String
cell.descriptionLabel.sizeToFit()
cell.textLabel?.backgroundColor = UIColor.clearColor()
cell.selectionStyle = .None
return cell
}
,但没有得到完整的内容
我没有得到我的完整描述。 – iDeveloper
http://stackoverflow.com/questions/39888512/tableview-cell-how-do-we-resize-cell-in-swift-along-with-image-and-label/39888662#39888662 –
我没有使用AutoLayout 。 – iDeveloper