Subclassing UITableViewCell content view in interface builder breaks auto-layout

Originator:CharltonProvatas
Number:rdar://36584575 Date Originated:1/17/18
Status:Not resolved Resolved:
Product:UIKit Product Version:Xcode 9.2
Classification:UI/Usability Reproducible:Always
 
Subclassing UITableViewCell content view to some other UIView subclass breaks auto-layout.  This is setting the subclass in interface builder.  Please note that the subclass is an IBDesignable class (I don't know for sure if that is a determining factor).  

Steps to Reproduce:
1. Create Empty Xib and drag UITableViewCell into it (setting file owner is not necessary)
2. Set content view to some custom UIView in the attributes inspector
3. Link up the usual UITableView `cell(forRow:)` etc. delegate/datasource methods and use `dequeueReusableCell(withIdentifier:)`  to display the table view cell.  

Expected Results: All constraints remain intact that were set in Interface Builder

Actual Results:
No constraints are respected and all subviews are pushed to CGPointZero within the superview.  Visual Debugger shows Vertical and Horizontal Position Ambiguity for all subviews of the cell.  Constraint inspector (within visual debugger) shows that only intrinsic content size constraints are active.

Version/Build: Xcode 9.2.  Swift 4.1

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com 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!