[英]Autolayout issues after upgrading to xcode 7
我有一個UITableViewController
有一組與一些動態內容靜態UITableViewCells的,但升級到了XCode 7后,細胞沒有調整了,內容重疊下面的單元格。 我注意到以下“ rect”標記已添加到情節提要中。
<rect key="frame" x="8" y="8" width="584" height="584"/>
單元格內的內容是一個UIImageView
,具有1:1的比例約束,因此它始終貼在側面並調整其高度。
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>
看來這是與以下問題類似的問題: iOS8使用Interface Builder自動調整靜態TableView單元的大小
為了使靜態UITableViewCell
根據其內容自動調整大小,您必須添加以下代碼: iOS8:可以為靜態單元格使用“ tableview.rowHeight = UITableViewAutomaticDimension”嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.