swift4:我场景中的 none 个文本字段是可编辑的
swift4: none of textfields in my scene are editable
我的故事板中有一个场景,其所有字段在应用程序 运行 期间均不可编辑。
注意。 我检查了所有文本字段及其所有父字段 userInteractionEnabled
是 true
并且由于这个问题 (My TextField is not editable) 但它没有帮助。我还有其他这样的场景,无需使用任何委托或类似的东西就可以工作,并且它们的文本字段仍然可以编辑。
我确实注释掉了它相关的视图控制器中的所有内容,但是它并没有改变这种情况。
我把它的 XML 代码放在这里供你参考,你可能会找到任何导致这种情况的东西。
我对我的场景所做的更改是:将所有项目放在 StackView 内的嵌套视图中,如果它有一些约束 + 从 Swift3 迁移到 Swift4。
<viewController storyboardIdentifier="CreateNewAddressViewController" id="meF-fr-sNf" customClass="CreateNewAddressViewController" customModule="nopStation" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="AwK-Dk-u5T">
<rect key="frame" x="0.0" y="0.0" width="375" height="800"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="FhN-qH-KZv">
<rect key="frame" x="10" y="84" width="355" height="646"/>
<subviews>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="goD-MV-xj2">
<rect key="frame" x="0.0" y="0.0" width="355" height="590"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" fixedFrame="YES" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="o9G-FL-lqF">
<rect key="frame" x="10" y="0.0" width="335" height="290"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="WMA-Km-72c">
<rect key="frame" x="0.0" y="0.0" width="335" height="40"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="First Name" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="fKn-8z-Pzc">
<rect key="frame" x="0.0" y="0.0" width="316.5" height="40"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<textInputTraits key="textInputTraits"/>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="*" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fUe-Bq-W8T">
<rect key="frame" x="326.5" y="9.5" width="8.5" height="21.5"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
<color key="textColor" name="RequiredFieldColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dMl-Cd-fC6">
<rect key="frame" x="0.0" y="38" width="335" height="2"/>
<color key="backgroundColor" red="0.66666666669999997" green="0.66666666669999997" blue="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="2" id="Yrr-ai-qmM"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="dMl-Cd-fC6" firstAttribute="leading" secondItem="WMA-Km-72c" secondAttribute="leading" id="4z7-jV-IUk"/>
<constraint firstAttribute="bottom" secondItem="dMl-Cd-fC6" secondAttribute="bottom" id="F8F-RI-rg4"/>
<constraint firstItem="fUe-Bq-W8T" firstAttribute="centerY" secondItem="WMA-Km-72c" secondAttribute="centerY" id="I89-Go-X44"/>
<constraint firstAttribute="bottom" secondItem="fKn-8z-Pzc" secondAttribute="bottom" id="JTN-Ml-5Eo"/>
<constraint firstItem="fUe-Bq-W8T" firstAttribute="leading" secondItem="fKn-8z-Pzc" secondAttribute="trailing" constant="10" id="RcN-3E-CP8"/>
<constraint firstAttribute="trailing" secondItem="dMl-Cd-fC6" secondAttribute="trailing" id="X8s-r3-rol"/>
<constraint firstItem="fKn-8z-Pzc" firstAttribute="top" secondItem="WMA-Km-72c" secondAttribute="top" id="bek-aj-mKk"/>
<constraint firstItem="fKn-8z-Pzc" firstAttribute="leading" secondItem="WMA-Km-72c" secondAttribute="leading" id="ghL-fb-IFL"/>
<constraint firstAttribute="trailing" secondItem="fUe-Bq-W8T" secondAttribute="trailing" id="tmI-VS-dyA"/>
<constraint firstAttribute="height" constant="40" id="xLm-i2-YEp"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="P0X-pA-gjs">
<rect key="frame" x="0.0" y="50" width="335" height="40"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Last Name" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="DfQ-XX-xII">
<rect key="frame" x="0.0" y="0.0" width="316.5" height="40"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<textInputTraits key="textInputTraits"/>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="*" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7TX-E6-XLu">
<rect key="frame" x="326.5" y="9.5" width="8.5" height="21.5"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
<color key="textColor" name="RequiredFieldColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="5hQ-6V-Wq0">
<rect key="frame" x="0.0" y="38" width="335" height="2"/>
<color key="backgroundColor" red="0.66666666669999997" green="0.66666666669999997" blue="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="2" id="FNO-9t-n52"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="DfQ-XX-xII" firstAttribute="top" secondItem="P0X-pA-gjs" secondAttribute="top" id="0g2-tp-rW4"/>
<constraint firstAttribute="trailing" secondItem="5hQ-6V-Wq0" secondAttribute="trailing" id="8eK-Vx-f2y"/>
<constraint firstAttribute="bottom" secondItem="5hQ-6V-Wq0" secondAttribute="bottom" id="Fiu-Kw-SJQ"/>
<constraint firstAttribute="bottom" secondItem="DfQ-XX-xII" secondAttribute="bottom" id="LqW-0G-dQv"/>
<constraint firstItem="5hQ-6V-Wq0" firstAttribute="leading" secondItem="P0X-pA-gjs" secondAttribute="leading" id="RAi-YU-lOk"/>
<constraint firstItem="DfQ-XX-xII" firstAttribute="leading" secondItem="P0X-pA-gjs" secondAttribute="leading" id="hQA-Cy-Icv"/>
<constraint firstAttribute="height" constant="40" id="jpn-Ph-BBz"/>
<constraint firstItem="7TX-E6-XLu" firstAttribute="centerY" secondItem="P0X-pA-gjs" secondAttribute="centerY" id="kXU-Bp-hcH"/>
<constraint firstAttribute="trailing" secondItem="7TX-E6-XLu" secondAttribute="trailing" id="wc4-6s-KgF"/>
<constraint firstItem="7TX-E6-XLu" firstAttribute="leading" secondItem="DfQ-XX-xII" secondAttribute="trailing" constant="10" id="zHs-Pr-2vS"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Nnr-ax-dhk">
<rect key="frame" x="0.0" y="100" width="335" height="40"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Email" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="BhZ-fY-4k7">
<rect key="frame" x="0.0" y="0.0" width="316.5" height="40"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<textInputTraits key="textInputTraits"/>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="*" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="j0N-ZY-V0Y">
<rect key="frame" x="326.5" y="9.5" width="8.5" height="21.5"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
<color key="textColor" name="RequiredFieldColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nTG-O0-l4y">
<rect key="frame" x="0.0" y="38" width="335" height="2"/>
<color key="backgroundColor" red="0.66666666669999997" green="0.66666666669999997" blue="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="2" id="u9W-Yq-hih"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="BhZ-fY-4k7" firstAttribute="leading" secondItem="Nnr-ax-dhk" secondAttribute="leading" id="3hK-ug-6Ys"/>
<constraint firstAttribute="trailing" secondItem="nTG-O0-l4y" secondAttribute="trailing" id="54C-vF-p3i"/>
<constraint firstAttribute="bottom" secondItem="nTG-O0-l4y" secondAttribute="bottom" id="7ef-y6-enL"/>
<constraint firstAttribute="trailing" secondItem="j0N-ZY-V0Y" secondAttribute="trailing" id="B5b-XV-RYP"/>
<constraint firstItem="j0N-ZY-V0Y" firstAttribute="centerY" secondItem="Nnr-ax-dhk" secondAttribute="centerY" id="BUL-N2-cNw"/>
<constraint firstItem="nTG-O0-l4y" firstAttribute="leading" secondItem="Nnr-ax-dhk" secondAttribute="leading" id="Nib-ZA-Ihq"/>
<constraint firstItem="BhZ-fY-4k7" firstAttribute="top" secondItem="Nnr-ax-dhk" secondAttribute="top" id="Rey-qG-CSa"/>
<constraint firstItem="j0N-ZY-V0Y" firstAttribute="leading" secondItem="BhZ-fY-4k7" secondAttribute="trailing" constant="10" id="dx4-BK-uWj"/>
<constraint firstAttribute="bottom" secondItem="BhZ-fY-4k7" secondAttribute="bottom" id="p5m-SO-CZ7"/>
<constraint firstAttribute="height" constant="40" id="wBB-11-ud1"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="m6n-mP-IDR">
<rect key="frame" x="0.0" y="150" width="335" height="40"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Address 1" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="9Xe-87-5pU">
<rect key="frame" x="0.0" y="0.0" width="316.5" height="38"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<textInputTraits key="textInputTraits"/>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="*" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cLO-wm-dKq">
<rect key="frame" x="326.5" y="9.5" width="8.5" height="21.5"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
<color key="textColor" name="RequiredFieldColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0v1-IU-zJP">
<rect key="frame" x="0.0" y="38" width="335" height="2"/>
<color key="backgroundColor" red="0.66666666669999997" green="0.66666666669999997" blue="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="2" id="xj6-r6-dVL"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="0v1-IU-zJP" secondAttribute="trailing" id="7ol-EC-Z7f"/>
<constraint firstItem="0v1-IU-zJP" firstAttribute="top" secondItem="9Xe-87-5pU" secondAttribute="bottom" id="9Kh-vz-aHF"/>
<constraint firstItem="cLO-wm-dKq" firstAttribute="leading" secondItem="9Xe-87-5pU" secondAttribute="trailing" constant="10" id="BzA-q4-AUa"/>
<constraint firstItem="cLO-wm-dKq" firstAttribute="centerY" secondItem="m6n-mP-IDR" secondAttribute="centerY" id="DLF-Sg-4fb"/>
<constraint firstAttribute="trailing" secondItem="cLO-wm-dKq" secondAttribute="trailing" id="Ddh-gm-hyM"/>
<constraint firstItem="9Xe-87-5pU" firstAttribute="top" secondItem="m6n-mP-IDR" secondAttribute="top" id="V6F-fl-0nK"/>
<constraint firstItem="0v1-IU-zJP" firstAttribute="leading" secondItem="m6n-mP-IDR" secondAttribute="leading" id="cly-NY-H6S"/>
<constraint firstItem="9Xe-87-5pU" firstAttribute="leading" secondItem="m6n-mP-IDR" secondAttribute="leading" id="mCt-JT-svl"/>
<constraint firstAttribute="height" constant="40" id="sGm-DQ-Zyt"/>
<constraint firstAttribute="bottom" secondItem="0v1-IU-zJP" secondAttribute="bottom" id="uXh-8G-dAn"/>
</constraints>
</view>
<rect key="frame" x="0.0" y="250" width="335" height="40"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Phone Number" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="ykM-gm-kv4">
<rect key="frame" x="0.0" y="0.0" width="316.5" height="40"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<textInputTraits key="textInputTraits"/>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="*" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="l86-0I-WbN">
<rect key="frame" x="326.5" y="9.5" width="8.5" height="21.5"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
<color key="textColor" name="RequiredFieldColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="b1z-D7-bNt">
<rect key="frame" x="0.0" y="38" width="335" height="2"/>
<color key="backgroundColor" red="0.66666666669999997" green="0.66666666669999997" blue="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="2" id="4ev-LH-vny"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="l86-0I-WbN" firstAttribute="leading" secondItem="ykM-gm-kv4" secondAttribute="trailing" constant="10" id="6qg-ch-5Kj"/>
<constraint firstItem="ykM-gm-kv4" firstAttribute="top" secondItem="FsO-iO-UA3" secondAttribute="top" id="81o-ef-AGF"/>
<constraint firstAttribute="height" constant="40" id="9mW-zj-58j"/>
<constraint firstItem="ykM-gm-kv4" firstAttribute="centerY" secondItem="FsO-iO-UA3" secondAttribute="centerY" id="Amc-P7-79p"/>
<constraint firstAttribute="bottom" secondItem="b1z-D7-bNt" secondAttribute="bottom" id="HBK-sg-EAD"/>
<constraint firstItem="ykM-gm-kv4" firstAttribute="leading" secondItem="FsO-iO-UA3" secondAttribute="leading" id="RcY-bk-6yR"/>
<constraint firstAttribute="trailing" secondItem="b1z-D7-bNt" secondAttribute="trailing" id="W2P-F3-Hlg"/>
<constraint firstAttribute="trailing" secondItem="l86-0I-WbN" secondAttribute="trailing" id="efh-fE-eln"/>
<constraint firstItem="l86-0I-WbN" firstAttribute="centerY" secondItem="FsO-iO-UA3" secondAttribute="centerY" id="hgs-xM-U20"/>
<constraint firstItem="b1z-D7-bNt" firstAttribute="leading" secondItem="FsO-iO-UA3" secondAttribute="leading" id="qLG-Sc-NEU"/>
<constraint firstAttribute="bottom" secondItem="ykM-gm-kv4" secondAttribute="bottom" id="yg9-Kg-K83"/>
</constraints>
</view>
</subviews>
</stackView>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="goD-MV-xj2" secondAttribute="trailing" id="Dak-14-pgV"/>
<constraint firstAttribute="bottom" secondItem="goD-MV-xj2" secondAttribute="bottom" id="Eve-uT-c8i"/>
<constraint firstItem="goD-MV-xj2" firstAttribute="leading" secondItem="FhN-qH-KZv" secondAttribute="leading" id="HWd-e0-G4Q"/>
<constraint firstItem="goD-MV-xj2" firstAttribute="top" secondItem="FhN-qH-KZv" secondAttribute="top" id="ln7-n8-Afi"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="4"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</scrollView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4cS-bG-FbJ">
<rect key="frame" x="10" y="734" width="355" height="40"/>
<color key="backgroundColor" name="AccentColor"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="MoG-YS-fiL"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<state key="normal" title="SAVE">
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="4"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="saveBtnAct:" destination="meF-fr-sNf" eventType="touchUpInside" id="3cT-XX-k4z"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="0.8862745098" green="0.8862745098" blue="0.8862745098" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="gQb-mV-QRj" firstAttribute="trailing" secondItem="FhN-qH-KZv" secondAttribute="trailing" constant="10" id="Ke5-D5-K26"/>
<constraint firstItem="4cS-bG-FbJ" firstAttribute="leading" secondItem="gQb-mV-QRj" secondAttribute="leading" constant="10" id="Tk0-nE-xox"/>
<constraint firstItem="gQb-mV-QRj" firstAttribute="bottom" secondItem="4cS-bG-FbJ" secondAttribute="bottom" constant="26" id="Zor-Jg-W1u"/>
<constraint firstItem="4cS-bG-FbJ" firstAttribute="top" secondItem="FhN-qH-KZv" secondAttribute="bottom" constant="4" id="clQ-NQ-TBp"/>
<constraint firstItem="goD-MV-xj2" firstAttribute="width" secondItem="AwK-Dk-u5T" secondAttribute="width" constant="-20" id="h9X-0l-yIk"/>
<constraint firstItem="FhN-qH-KZv" firstAttribute="top" secondItem="gQb-mV-QRj" secondAttribute="top" constant="64" id="i2a-Mw-TF0"/>
<constraint firstItem="FhN-qH-KZv" firstAttribute="leading" secondItem="gQb-mV-QRj" secondAttribute="leading" constant="10" id="qEg-VO-wiQ"/>
<constraint firstItem="gQb-mV-QRj" firstAttribute="trailing" secondItem="4cS-bG-FbJ" secondAttribute="trailing" constant="10" id="u44-kZ-irC"/>
</constraints>
<viewLayoutGuide key="safeArea" id="gQb-mV-QRj"/>
</view>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<size key="freeformSize" width="375" height="800"/>
<connections>
<outlet property="address1RequiredLabel" destination="cLO-wm-dKq" id="4ze-PL-To9"/>
<outlet property="address1TextField" destination="9Xe-87-5pU" id="uMF-aw-PQZ"/>
<outlet property="address2RequiredLabel" destination="Bnx-Sa-95p" id="882-gU-i1B"/>
<outlet property="address2TextField" destination="zB0-7l-zSy" id="OCL-Wg-V3e"/>
<outlet property="containerScrollView" destination="FhN-qH-KZv" id="Qgr-4M-3ah"/>
<outlet property="emailRequiredLabel" destination="j0N-ZY-V0Y" id="H2q-yS-KW4"/>
<outlet property="emailTextField" destination="BhZ-fY-4k7" id="ctw-kQ-7hc"/>
<outlet property="firstNameRequiredLabel" destination="fUe-Bq-W8T" id="Pp0-BF-EIE"/>
<outlet property="firstNameTextField" destination="fKn-8z-Pzc" id="CgT-Uw-Ixy"/>
<outlet property="lastNameRequiredLabel" destination="7TX-E6-XLu" id="gap-4c-FWJ"/>
<outlet property="lastNameTextField" destination="DfQ-XX-xII" id="H92-Zq-2u2"/>
<outlet property="phoneNumberRequiredTextField" destination="l86-0I-WbN" id="CGi-on-wOu"/>
<outlet property="phoneNumberTextField" destination="ykM-gm-kv4" id="MbB-FK-z0c"/>
<outlet property="saveBtn" destination="4cS-bG-FbJ" id="XPF-Hi-Xtb"/>
<outlet property="saveBtnBottomConstant" destination="Zor-Jg-W1u" id="UJd-is-ceY"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="ssH-lW-xhj" userLabel="First Responder" sceneMemberID="firstResponder"/>
我已将您的故事板粘贴到我的测试项目中并尝试调试此问题。发现当移除ScrollView
和StackView
之间的视图(下图红色高亮部分),直接将StackView
放在Container ScrollView
里面时,textFields
变得可点击。
您给出的故事板:
删除 Container Scroll 视图中的视图并将 StackView 直接移动到 Container ScrollView 下后。
移除中间视图后的模拟器截图
我的故事板中有一个场景,其所有字段在应用程序 运行 期间均不可编辑。
注意。 我检查了所有文本字段及其所有父字段 userInteractionEnabled
是 true
并且由于这个问题 (My TextField is not editable) 但它没有帮助。我还有其他这样的场景,无需使用任何委托或类似的东西就可以工作,并且它们的文本字段仍然可以编辑。
我确实注释掉了它相关的视图控制器中的所有内容,但是它并没有改变这种情况。 我把它的 XML 代码放在这里供你参考,你可能会找到任何导致这种情况的东西。
我对我的场景所做的更改是:将所有项目放在 StackView 内的嵌套视图中,如果它有一些约束 + 从 Swift3 迁移到 Swift4。
<viewController storyboardIdentifier="CreateNewAddressViewController" id="meF-fr-sNf" customClass="CreateNewAddressViewController" customModule="nopStation" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="AwK-Dk-u5T">
<rect key="frame" x="0.0" y="0.0" width="375" height="800"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="FhN-qH-KZv">
<rect key="frame" x="10" y="84" width="355" height="646"/>
<subviews>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="goD-MV-xj2">
<rect key="frame" x="0.0" y="0.0" width="355" height="590"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" fixedFrame="YES" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="o9G-FL-lqF">
<rect key="frame" x="10" y="0.0" width="335" height="290"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="WMA-Km-72c">
<rect key="frame" x="0.0" y="0.0" width="335" height="40"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="First Name" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="fKn-8z-Pzc">
<rect key="frame" x="0.0" y="0.0" width="316.5" height="40"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<textInputTraits key="textInputTraits"/>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="*" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fUe-Bq-W8T">
<rect key="frame" x="326.5" y="9.5" width="8.5" height="21.5"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
<color key="textColor" name="RequiredFieldColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dMl-Cd-fC6">
<rect key="frame" x="0.0" y="38" width="335" height="2"/>
<color key="backgroundColor" red="0.66666666669999997" green="0.66666666669999997" blue="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="2" id="Yrr-ai-qmM"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="dMl-Cd-fC6" firstAttribute="leading" secondItem="WMA-Km-72c" secondAttribute="leading" id="4z7-jV-IUk"/>
<constraint firstAttribute="bottom" secondItem="dMl-Cd-fC6" secondAttribute="bottom" id="F8F-RI-rg4"/>
<constraint firstItem="fUe-Bq-W8T" firstAttribute="centerY" secondItem="WMA-Km-72c" secondAttribute="centerY" id="I89-Go-X44"/>
<constraint firstAttribute="bottom" secondItem="fKn-8z-Pzc" secondAttribute="bottom" id="JTN-Ml-5Eo"/>
<constraint firstItem="fUe-Bq-W8T" firstAttribute="leading" secondItem="fKn-8z-Pzc" secondAttribute="trailing" constant="10" id="RcN-3E-CP8"/>
<constraint firstAttribute="trailing" secondItem="dMl-Cd-fC6" secondAttribute="trailing" id="X8s-r3-rol"/>
<constraint firstItem="fKn-8z-Pzc" firstAttribute="top" secondItem="WMA-Km-72c" secondAttribute="top" id="bek-aj-mKk"/>
<constraint firstItem="fKn-8z-Pzc" firstAttribute="leading" secondItem="WMA-Km-72c" secondAttribute="leading" id="ghL-fb-IFL"/>
<constraint firstAttribute="trailing" secondItem="fUe-Bq-W8T" secondAttribute="trailing" id="tmI-VS-dyA"/>
<constraint firstAttribute="height" constant="40" id="xLm-i2-YEp"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="P0X-pA-gjs">
<rect key="frame" x="0.0" y="50" width="335" height="40"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Last Name" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="DfQ-XX-xII">
<rect key="frame" x="0.0" y="0.0" width="316.5" height="40"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<textInputTraits key="textInputTraits"/>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="*" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7TX-E6-XLu">
<rect key="frame" x="326.5" y="9.5" width="8.5" height="21.5"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
<color key="textColor" name="RequiredFieldColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="5hQ-6V-Wq0">
<rect key="frame" x="0.0" y="38" width="335" height="2"/>
<color key="backgroundColor" red="0.66666666669999997" green="0.66666666669999997" blue="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="2" id="FNO-9t-n52"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="DfQ-XX-xII" firstAttribute="top" secondItem="P0X-pA-gjs" secondAttribute="top" id="0g2-tp-rW4"/>
<constraint firstAttribute="trailing" secondItem="5hQ-6V-Wq0" secondAttribute="trailing" id="8eK-Vx-f2y"/>
<constraint firstAttribute="bottom" secondItem="5hQ-6V-Wq0" secondAttribute="bottom" id="Fiu-Kw-SJQ"/>
<constraint firstAttribute="bottom" secondItem="DfQ-XX-xII" secondAttribute="bottom" id="LqW-0G-dQv"/>
<constraint firstItem="5hQ-6V-Wq0" firstAttribute="leading" secondItem="P0X-pA-gjs" secondAttribute="leading" id="RAi-YU-lOk"/>
<constraint firstItem="DfQ-XX-xII" firstAttribute="leading" secondItem="P0X-pA-gjs" secondAttribute="leading" id="hQA-Cy-Icv"/>
<constraint firstAttribute="height" constant="40" id="jpn-Ph-BBz"/>
<constraint firstItem="7TX-E6-XLu" firstAttribute="centerY" secondItem="P0X-pA-gjs" secondAttribute="centerY" id="kXU-Bp-hcH"/>
<constraint firstAttribute="trailing" secondItem="7TX-E6-XLu" secondAttribute="trailing" id="wc4-6s-KgF"/>
<constraint firstItem="7TX-E6-XLu" firstAttribute="leading" secondItem="DfQ-XX-xII" secondAttribute="trailing" constant="10" id="zHs-Pr-2vS"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Nnr-ax-dhk">
<rect key="frame" x="0.0" y="100" width="335" height="40"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Email" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="BhZ-fY-4k7">
<rect key="frame" x="0.0" y="0.0" width="316.5" height="40"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<textInputTraits key="textInputTraits"/>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="*" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="j0N-ZY-V0Y">
<rect key="frame" x="326.5" y="9.5" width="8.5" height="21.5"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
<color key="textColor" name="RequiredFieldColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nTG-O0-l4y">
<rect key="frame" x="0.0" y="38" width="335" height="2"/>
<color key="backgroundColor" red="0.66666666669999997" green="0.66666666669999997" blue="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="2" id="u9W-Yq-hih"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="BhZ-fY-4k7" firstAttribute="leading" secondItem="Nnr-ax-dhk" secondAttribute="leading" id="3hK-ug-6Ys"/>
<constraint firstAttribute="trailing" secondItem="nTG-O0-l4y" secondAttribute="trailing" id="54C-vF-p3i"/>
<constraint firstAttribute="bottom" secondItem="nTG-O0-l4y" secondAttribute="bottom" id="7ef-y6-enL"/>
<constraint firstAttribute="trailing" secondItem="j0N-ZY-V0Y" secondAttribute="trailing" id="B5b-XV-RYP"/>
<constraint firstItem="j0N-ZY-V0Y" firstAttribute="centerY" secondItem="Nnr-ax-dhk" secondAttribute="centerY" id="BUL-N2-cNw"/>
<constraint firstItem="nTG-O0-l4y" firstAttribute="leading" secondItem="Nnr-ax-dhk" secondAttribute="leading" id="Nib-ZA-Ihq"/>
<constraint firstItem="BhZ-fY-4k7" firstAttribute="top" secondItem="Nnr-ax-dhk" secondAttribute="top" id="Rey-qG-CSa"/>
<constraint firstItem="j0N-ZY-V0Y" firstAttribute="leading" secondItem="BhZ-fY-4k7" secondAttribute="trailing" constant="10" id="dx4-BK-uWj"/>
<constraint firstAttribute="bottom" secondItem="BhZ-fY-4k7" secondAttribute="bottom" id="p5m-SO-CZ7"/>
<constraint firstAttribute="height" constant="40" id="wBB-11-ud1"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="m6n-mP-IDR">
<rect key="frame" x="0.0" y="150" width="335" height="40"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Address 1" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="9Xe-87-5pU">
<rect key="frame" x="0.0" y="0.0" width="316.5" height="38"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<textInputTraits key="textInputTraits"/>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="*" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cLO-wm-dKq">
<rect key="frame" x="326.5" y="9.5" width="8.5" height="21.5"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
<color key="textColor" name="RequiredFieldColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0v1-IU-zJP">
<rect key="frame" x="0.0" y="38" width="335" height="2"/>
<color key="backgroundColor" red="0.66666666669999997" green="0.66666666669999997" blue="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="2" id="xj6-r6-dVL"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="0v1-IU-zJP" secondAttribute="trailing" id="7ol-EC-Z7f"/>
<constraint firstItem="0v1-IU-zJP" firstAttribute="top" secondItem="9Xe-87-5pU" secondAttribute="bottom" id="9Kh-vz-aHF"/>
<constraint firstItem="cLO-wm-dKq" firstAttribute="leading" secondItem="9Xe-87-5pU" secondAttribute="trailing" constant="10" id="BzA-q4-AUa"/>
<constraint firstItem="cLO-wm-dKq" firstAttribute="centerY" secondItem="m6n-mP-IDR" secondAttribute="centerY" id="DLF-Sg-4fb"/>
<constraint firstAttribute="trailing" secondItem="cLO-wm-dKq" secondAttribute="trailing" id="Ddh-gm-hyM"/>
<constraint firstItem="9Xe-87-5pU" firstAttribute="top" secondItem="m6n-mP-IDR" secondAttribute="top" id="V6F-fl-0nK"/>
<constraint firstItem="0v1-IU-zJP" firstAttribute="leading" secondItem="m6n-mP-IDR" secondAttribute="leading" id="cly-NY-H6S"/>
<constraint firstItem="9Xe-87-5pU" firstAttribute="leading" secondItem="m6n-mP-IDR" secondAttribute="leading" id="mCt-JT-svl"/>
<constraint firstAttribute="height" constant="40" id="sGm-DQ-Zyt"/>
<constraint firstAttribute="bottom" secondItem="0v1-IU-zJP" secondAttribute="bottom" id="uXh-8G-dAn"/>
</constraints>
</view>
<rect key="frame" x="0.0" y="250" width="335" height="40"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Phone Number" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="ykM-gm-kv4">
<rect key="frame" x="0.0" y="0.0" width="316.5" height="40"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<textInputTraits key="textInputTraits"/>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="*" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="l86-0I-WbN">
<rect key="frame" x="326.5" y="9.5" width="8.5" height="21.5"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
<color key="textColor" name="RequiredFieldColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="b1z-D7-bNt">
<rect key="frame" x="0.0" y="38" width="335" height="2"/>
<color key="backgroundColor" red="0.66666666669999997" green="0.66666666669999997" blue="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="2" id="4ev-LH-vny"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="l86-0I-WbN" firstAttribute="leading" secondItem="ykM-gm-kv4" secondAttribute="trailing" constant="10" id="6qg-ch-5Kj"/>
<constraint firstItem="ykM-gm-kv4" firstAttribute="top" secondItem="FsO-iO-UA3" secondAttribute="top" id="81o-ef-AGF"/>
<constraint firstAttribute="height" constant="40" id="9mW-zj-58j"/>
<constraint firstItem="ykM-gm-kv4" firstAttribute="centerY" secondItem="FsO-iO-UA3" secondAttribute="centerY" id="Amc-P7-79p"/>
<constraint firstAttribute="bottom" secondItem="b1z-D7-bNt" secondAttribute="bottom" id="HBK-sg-EAD"/>
<constraint firstItem="ykM-gm-kv4" firstAttribute="leading" secondItem="FsO-iO-UA3" secondAttribute="leading" id="RcY-bk-6yR"/>
<constraint firstAttribute="trailing" secondItem="b1z-D7-bNt" secondAttribute="trailing" id="W2P-F3-Hlg"/>
<constraint firstAttribute="trailing" secondItem="l86-0I-WbN" secondAttribute="trailing" id="efh-fE-eln"/>
<constraint firstItem="l86-0I-WbN" firstAttribute="centerY" secondItem="FsO-iO-UA3" secondAttribute="centerY" id="hgs-xM-U20"/>
<constraint firstItem="b1z-D7-bNt" firstAttribute="leading" secondItem="FsO-iO-UA3" secondAttribute="leading" id="qLG-Sc-NEU"/>
<constraint firstAttribute="bottom" secondItem="ykM-gm-kv4" secondAttribute="bottom" id="yg9-Kg-K83"/>
</constraints>
</view>
</subviews>
</stackView>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="goD-MV-xj2" secondAttribute="trailing" id="Dak-14-pgV"/>
<constraint firstAttribute="bottom" secondItem="goD-MV-xj2" secondAttribute="bottom" id="Eve-uT-c8i"/>
<constraint firstItem="goD-MV-xj2" firstAttribute="leading" secondItem="FhN-qH-KZv" secondAttribute="leading" id="HWd-e0-G4Q"/>
<constraint firstItem="goD-MV-xj2" firstAttribute="top" secondItem="FhN-qH-KZv" secondAttribute="top" id="ln7-n8-Afi"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="4"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</scrollView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4cS-bG-FbJ">
<rect key="frame" x="10" y="734" width="355" height="40"/>
<color key="backgroundColor" name="AccentColor"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="MoG-YS-fiL"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<state key="normal" title="SAVE">
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="4"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="saveBtnAct:" destination="meF-fr-sNf" eventType="touchUpInside" id="3cT-XX-k4z"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="0.8862745098" green="0.8862745098" blue="0.8862745098" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="gQb-mV-QRj" firstAttribute="trailing" secondItem="FhN-qH-KZv" secondAttribute="trailing" constant="10" id="Ke5-D5-K26"/>
<constraint firstItem="4cS-bG-FbJ" firstAttribute="leading" secondItem="gQb-mV-QRj" secondAttribute="leading" constant="10" id="Tk0-nE-xox"/>
<constraint firstItem="gQb-mV-QRj" firstAttribute="bottom" secondItem="4cS-bG-FbJ" secondAttribute="bottom" constant="26" id="Zor-Jg-W1u"/>
<constraint firstItem="4cS-bG-FbJ" firstAttribute="top" secondItem="FhN-qH-KZv" secondAttribute="bottom" constant="4" id="clQ-NQ-TBp"/>
<constraint firstItem="goD-MV-xj2" firstAttribute="width" secondItem="AwK-Dk-u5T" secondAttribute="width" constant="-20" id="h9X-0l-yIk"/>
<constraint firstItem="FhN-qH-KZv" firstAttribute="top" secondItem="gQb-mV-QRj" secondAttribute="top" constant="64" id="i2a-Mw-TF0"/>
<constraint firstItem="FhN-qH-KZv" firstAttribute="leading" secondItem="gQb-mV-QRj" secondAttribute="leading" constant="10" id="qEg-VO-wiQ"/>
<constraint firstItem="gQb-mV-QRj" firstAttribute="trailing" secondItem="4cS-bG-FbJ" secondAttribute="trailing" constant="10" id="u44-kZ-irC"/>
</constraints>
<viewLayoutGuide key="safeArea" id="gQb-mV-QRj"/>
</view>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<size key="freeformSize" width="375" height="800"/>
<connections>
<outlet property="address1RequiredLabel" destination="cLO-wm-dKq" id="4ze-PL-To9"/>
<outlet property="address1TextField" destination="9Xe-87-5pU" id="uMF-aw-PQZ"/>
<outlet property="address2RequiredLabel" destination="Bnx-Sa-95p" id="882-gU-i1B"/>
<outlet property="address2TextField" destination="zB0-7l-zSy" id="OCL-Wg-V3e"/>
<outlet property="containerScrollView" destination="FhN-qH-KZv" id="Qgr-4M-3ah"/>
<outlet property="emailRequiredLabel" destination="j0N-ZY-V0Y" id="H2q-yS-KW4"/>
<outlet property="emailTextField" destination="BhZ-fY-4k7" id="ctw-kQ-7hc"/>
<outlet property="firstNameRequiredLabel" destination="fUe-Bq-W8T" id="Pp0-BF-EIE"/>
<outlet property="firstNameTextField" destination="fKn-8z-Pzc" id="CgT-Uw-Ixy"/>
<outlet property="lastNameRequiredLabel" destination="7TX-E6-XLu" id="gap-4c-FWJ"/>
<outlet property="lastNameTextField" destination="DfQ-XX-xII" id="H92-Zq-2u2"/>
<outlet property="phoneNumberRequiredTextField" destination="l86-0I-WbN" id="CGi-on-wOu"/>
<outlet property="phoneNumberTextField" destination="ykM-gm-kv4" id="MbB-FK-z0c"/>
<outlet property="saveBtn" destination="4cS-bG-FbJ" id="XPF-Hi-Xtb"/>
<outlet property="saveBtnBottomConstant" destination="Zor-Jg-W1u" id="UJd-is-ceY"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="ssH-lW-xhj" userLabel="First Responder" sceneMemberID="firstResponder"/>
我已将您的故事板粘贴到我的测试项目中并尝试调试此问题。发现当移除ScrollView
和StackView
之间的视图(下图红色高亮部分),直接将StackView
放在Container ScrollView
里面时,textFields
变得可点击。
您给出的故事板:
删除 Container Scroll 视图中的视图并将 StackView 直接移动到 Container ScrollView 下后。
移除中间视图后的模拟器截图