我有一個可擴展的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