Demystifying self-sizing cells
summary
Live debugging shows UITableView uses UIView.systemLayoutSizeFittingSize with a required horizontal priority (1000) and a vertical fitting priority of 50 to pick the smallest height (example result 414×46.5); collection views pass the estimated item size (42×42) but sometimes reuse a 200×278 size unexpectedly. Tools used: symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints, Accessibility Inspector and Reveal. Fixes and workarounds demonstrated: constrain the contentView not the cell, set minimum height on contentView (60), and force re-layout with beginUpdates/endUpdates.
AI-written summary · about
chapters (12)
- 0:00Intro
- 2:05The app
- 3:04Demo
- 5:15Constraints
- 7:42Inspecting the backtrace
- 11:07Override systemlayoutsize
- 11:54Investigate systemlayoutsize
- 16:45Investigate minimum height
- 17:32Review constraints
- 21:52Favorite a team
- 26:37Headers
- 34:02CollectionView
related talks
25mSize Doesn't Matter: Building an App for Every iOS Device
47mPixel perfect is dead, long live to adaptive and accessible iOS apps
35mScaling beyond Storyboards
18mBuilding Apps with Compositional Layout
35mUnder the hood: 3D transforms of iOS Views
52miOS Animations with Auto Layout
29mAuditing your App with the Accessibility Inspector
22mTaming a Four-Year-Old Detail Screen That Slowed Down Over Time
