我想澄清一下你們的問題。修復了由於缺少Rect標記而導致的UITableViewCell底部邊距問題
最近我只是升級我的Xcode到最新的Xcode 6.0.1(Maverick OS)並繼續我的項目由Xcode 5創建沒有問題。
直到我創造新的UITableViewCell,並把與固定的下緣幾個視圖控制器中的表現時。與固定的底部邊緣的視圖Y位置搞砸了, 但..它弄亂......這不是與發生現有的UITableViewCell是在Xcode 5上創建的。它具有固定底部邊距的View,但是錯誤沒有發生,當我調整UITableViewCell的大小時,它調整位置就好了。
繼續我的調試,我嘗試重新創建現有的UITableViewCell並得到相同的錯誤。經過多次測試後,我決定通過在文本編輯器中打開XIB來比較視圖,並發現導致錯誤的一點區別。
您可以比較2 UITableViewCell波紋管之間的結果。左圖是使用Xcode 5上創建的現有UITableViewCell,以及Xcode 6上創建的右圖。「text 2」標籤Y位置已經混亂並超出了單元格高度。
如果您檢查Xcode IB,所有設置都是相同的。但是,文本編輯器顯示更重要的是
現有的UITableViewCell(Xcode中5)
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="WSPostCell" rowHeight="100" id="PdK-a2-c84" customClass="WSPostCell">
<rect key="frame" x="0.0" y="0.0" width="320" height="100"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="PdK-a2-c84" id="Y9d-Wv-BGf">
<rect key="frame" x="0.0" y="0.0" width="320" height="99"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Text 1" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Vuu-pP-JOA">
<rect key="frame" x="20" y="8" width="280" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Text 2" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="40X-YI-rMb">
<rect key="frame" x="20" y="61" width="280" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<point key="canvasLocation" x="127" y="120"/>
</tableViewCell>
新的UITableViewCell(Xcode6)
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="100" id="aI1-wx-nYK">
<rect key="frame" x="0.0" y="0.0" width="320" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="aI1-wx-nYK" id="dNV-Xk-dVs">
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Text 1" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="N8L-oO-ECr">
<rect key="frame" x="8" y="8" width="280" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Text 2" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="IZV-oh-bet">
<rect key="frame" x="8" y="61" width="280" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<point key="canvasLocation" x="511" y="120"/>
</tableViewCell>
如果你仔細的看第二個XML丟失<rect>
標記<tableViewCellContentView>
標記後。
<rect key="frame" x="0.0" y="0.0" width="320" height="99"/>
這是一個錯誤?或者我錯過了導致這個可怕錯誤的東西?我在File Inspector上禁用Auto Layout和Size classes。
我有同樣的問題,我填寫了一個錯誤報告。它發生在XCode 6和XCode 6.1上。 – rFlex 2014-10-14 02:16:26