我的UITextView
. Textview
结束了UiView
。我view
在故事板中的宽度相等,但高度必须调整大小以支持 iPhone 5。
问题是总是有一个高度相等的约束,我无法删除。如果我将其更改为“大于或小于”并更改值,我的textview
. 我只能从textview
.
如果我将约束更改为“提升到用户约束”,我可以将其删除,但会立即出现一个新的约束来固定高度。
将优先级更改为 1 并不能解决问题。
所以视图的高度不会自动调整大小。
在另一个视图中,我的 tableview 的大小调整工作正常,只有 textview 在这里出现问题。
如何删除相等约束,以便只有大于的约束处于活动状态?
编辑:这是来自视图的源代码,包括约束。
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PNS-qQ-Qo3">
<subviews>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="RdG-Gf-pbO">
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" priority="1" constant="158" type="user" id="h7G-zb-nwt"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="158" type="user" id="oh5-nf-nRk"/>
</constraints>
<string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="RdG-Gf-pbO" firstAttribute="leading" secondItem="PNS-qQ-Qo3" secondAttribute="leading" type="default" id="6vI-dT-4NX"/>
<constraint firstItem="RdG-Gf-pbO" firstAttribute="trailing" secondItem="PNS-qQ-Qo3" secondAttribute="trailing" type="default" id="Jkf-Hd-9rp"/>
<constraint firstItem="RdG-Gf-pbO" firstAttribute="top" secondItem="PNS-qQ-Qo3" secondAttribute="top" constant="20" symbolic="YES" type="default" id="v4W-JC-W0R"/>
</constraints>
</view>
编辑 2:这是在超级视图中进行更改的源代码:
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PNS-qQ-Qo3">
<subviews>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="RdG-Gf-pbO">
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="158" id="0fk-CS-M1r"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="158" type="user" id="Mjt-GD-N8k"/>
</constraints>
<string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="RdG-Gf-pbO" firstAttribute="trailing" secondItem="PNS-qQ-Qo3" secondAttribute="trailing" type="user" id="7gP-1C-I3d"/>
<constraint firstAttribute="bottom" relation="lessThanOrEqual" secondItem="RdG-Gf-pbO" secondAttribute="bottom" constant="85" type="user" id="MlS-gF-VZh"/>
<constraint firstAttribute="width" constant="300" type="user" id="NTZ-bO-H1C"/>
<constraint firstItem="RdG-Gf-pbO" firstAttribute="leading" secondItem="PNS-qQ-Qo3" secondAttribute="leading" type="user" id="PsM-KW-5oX"/>
<constraint firstItem="RdG-Gf-pbO" firstAttribute="top" relation="lessThanOrEqual" secondItem="PNS-qQ-Qo3" secondAttribute="top" constant="58" type="user" id="Ugg-3p-tLX"/>
<constraint firstAttribute="centerX" secondItem="RdG-Gf-pbO" secondAttribute="centerX" type="user" id="Z5B-5s-oK9"/>
<constraint firstAttribute="height" relation="lessThanOrEqual" constant="273" type="user" id="cCP-z5-3jO"/>
<constraint firstItem="RdG-Gf-pbO" firstAttribute="top" secondItem="PNS-qQ-Qo3" secondAttribute="top" constant="21" type="user" id="xnR-aM-hzt"/>
</constraints>
</view>