I have a UITableViewController
with a set of static UITableViewCells with some dynamic content, but after upgrading to XCode 7, the cells are not resizing anymore, and the content overlaps the cells below. I noticed the following 'rect' tags are added to the storyboard.
<rect key="frame" x="8" y="8" width="584" height="584"/>
The content inside the cell, is a UIImageView
with a 1:1 ratio constraints, so that it always stick to the sides and is resized in height.
Constraints for the UITableViewCell
.
<tableViewCell userInteractionEnabled="NO" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="TeM-3R-AKy">
<rect key="frame" x="0.0" y="124" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="TeM-3R-AKy" id="Ul9-Ad-TSI">
<rect key="frame" x="0.0" y="0.0" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="yolo" translatesAutoresizingMaskIntoConstraints="NO" id="Dno-dR-6h7">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<animations/>
<constraints>
<constraint firstAttribute="width" secondItem="Dno-dR-6h7" secondAttribute="height" multiplier="1:1" id="4gQ-ye-O6k"/>
<constraint firstAttribute="height" priority="999" constant="60" id="cBT-jH-WiC"/>
</constraints>
</imageView>
</subviews>
<animations/>
<constraints>
<constraint firstAttribute="trailing" secondItem="Dno-dR-6h7" secondAttribute="trailing" id="0K4-U7-ueq"/>
<constraint firstItem="Dno-dR-6h7" firstAttribute="leading" secondItem="Ul9-Ad-TSI" secondAttribute="leading" id="2ER-Tt-FFc"/>
<constraint firstAttribute="bottom" secondItem="Dno-dR-6h7" secondAttribute="bottom" priority="999" id="jfg-iH-H9u"/>
<constraint firstItem="Dno-dR-6h7" firstAttribute="top" secondItem="Ul9-Ad-TSI" secondAttribute="top" id="mcU-xf-gfx"/>
</constraints>
</tableViewCellContentView>
<animations/>
</tableViewCell>
Possible duplicate of: iOS8 self-sizing static TableView cells with Interface Builder