Daily iOS
UIKit

Self-sizing cells and Dynamic Type

A UIKit car listing cell has to grow in height and not truncate under the accessibility large text settings. How do you set up the constraints so the cell height is computed automatically from the text size?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

An unbroken vertical chain of constraints has to run from the cell's contentView top to the last label's bottom so Auto Layout can compute the cell height from the text height, and any height constraint should be greaterThanOrEqualTo instead of a fixed value.

Share a question