Recipe: Describing Constraints

When developing and debugging constraints, you may find it useful to produce human-readable descriptions of arbitrary NSLayoutConstraints. Recipe 5-6 builds concise strings that describe constraints as equations, as follows:

Image (1000)[UILabel:6bb32a0].right <= [self].right

Image (750)[self].width == ([self].height * 1.778)

Image (750)[UILabel:6bb32a0].leading == ([UILabel:6ed2e70].trailing + 60.000)

This recipe transforms constraint ...

Get The Core iOS Developer’s Cookbook, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.