I have custom cell and dynamic height of label in that cell. Then I add new cell, but height of all cells is equal (the same). My code:
class MyTable: UITableViewController {
var height: CGFloat = 0.0
/* ........ */
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let row = indexPath.row
/* make some action with objects in cell */
let cell = tableView.dequeueReusableCellWithIdentifier("order", forIndexPath: indexPath) as! OrderData
self.height = cell.address_lbl.frame.origin.y + cell.address_lbl.frame.height + 8
return cell
override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return self.height
}
}
I understand, that the question is duplicate, but I don't know, how to make dynamic height. P.S. that solution must work in iOS 7