Inconsistent automatic sizing of UITableViewCell content on iPhone X after rotations

Number:rdar://36665853 Date Originated:19.01.2018
Status:Open Resolved:
Product:UIKit Product Version:11.0
Classification:UI Reproducible:Always
Inconsistent automatic sizing of UITableViewCell content on iPhone X after rotations.

Reproducible with the following view hierarchy:
Cell (UITableViewCell subclass)
⌞ UITableViewCellContentView (standard one, untouched)
  ⌞ ContainerView (yellow; snapped to content view edges)
    ⌞ Label (green; snapped to container view layout margins)

Steps to Reproduce:
1. Open the attached sample project.
2. Build and run on a portrait iPhone X simulator or device.
3. **Observe**: label is displayed as expected (no extra padding).
4. Rotate to landscape.
5. **Observe**: label is truncated. **Expected**: label should take two lines as it's AutomaticDimension and numberOfLines = 0
6. Rotate back to portrait.
7. **Observe**: label gets extra top and bottom padding. **Expected**: label should look the same as just after launching.

Expected Results:
— Label is never truncated nor has extra padding.

Actual Results:
— Label is truncated in landscape and has extra vertical padding when back in portrait.

— Xcode 9.2 (9C40b),
— iOS 11.2 (15C107) Simulator, iOS 11.1.2 (15B202).

— Debug

Sample project:


I have the same problem, but didn't find your radar before:

I added a bit more details about the problem (margins are incorrect for tableView(_ :heightForRowAt:) and tableView(_ :estimatedHeightForRowAt:)), but tableView.superview margins are OK, so they can be used as a workarounds.

By adam.grzegorowski at June 25, 2018, 7:56 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!