The source of the sensei for the lessons of which I learn: designcode.io/cloud/Chapter3Part2-Swift2/11-TableViewClass.zip My source: github.com/gemcave/dn-ios-design-study Screen simulator Cell settings Sensei has estimatedRowHeight and UITableViewAutomaticDimension, I don’t.

    2 answers 2

    In the example that you are using there are two buttons that you don’t have - likes and comments. the buttons themselves are not important, but they add a few constraints that give ios a sense of how to position the elements. In your case, constraints are not enough, so when you start, the cell size becomes 44 (default), and the following message appears in the console:

    If you’re looking for a table view of a cell’s content view. We're considering> the collapse unintentional and using standard height instead.

    To fix this, it’s enough to add a constraint between the bottom of the cell and the bottom of the Author

    enter image description here

      I would recommend using

       func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat 

      And calculate the height of each cell dynamically. I use the following function:

        static func sizeLabel(text:String, font:UIFont, width:CGFloat) -> CGRect{ let label:UILabel = UILabel(frame: CGRectMake(0, 0, width, CGFloat.max)) label.numberOfLines = 0 label.lineBreakMode = NSLineBreakMode.ByWordWrapping label.font = font label.text = text label.sizeToFit() return label.frame }