升级到 xcode 7 后的自动布局问题

Autolayout issues after upgrading to xcode 7

我有一个 UITableViewController 带有一组带有一些动态内容的静态 UITableViewCells,但是在升级到 XCode 7 之后,单元格不再调整大小,并且内容与下面的单元格重叠。我注意到故事板中添加了以下 'rect' 标签。

<rect key="frame" x="8" y="8" width="584" height="584"/>

单元格内的内容是一个具有 1:1 比例限制的 UIImageView,因此它始终贴在两侧并调整高度。

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>

可能重复:

这似乎是在以下内容中讨论的类似问题:

为了让静态 UITableViewCell 根据其内容自动调整大小,您必须添加以下行: iOS8: Possible to use “tableview.rowHeight = UITableViewAutomaticDimension” for static cells?