iOS Dev Nugget 117 UIView-Encapsulated-Layout-Height


Need to run a code review on your codebase? Hire me

If you are using Auto Layout and haven't been using Auto-sizing UITableViewCells with your UITableViews, you should.

You might notice an error about not being able to simultaneously satisfy constraints, and something like this appears in the list of constraints:

"<NSLayoutConstraint:0x11eb07d50 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x1191f53c0(50)]>"

Chances are setting the priority for the constraint you add governing the cell's height to UILayoutPriorityDefaultHigh will fix it. It appears that that constraint is set by Auto Layout to enforce the calculated height, but it might clash with your own constraint. My guess is while it should give the same result, it sometimes doesn't due to floating point representation being imprecise.

Your feedback is valuable: Do you want more nuggets like this?   Yes   or   No



Like this and want such iOS dev nuggets to be emailed to you, weekly?

Sign Me Up! or follow @iosdevnuggets on Twitter


View archives of past issues