Storyboard confusion: UITextView and UIView not visible, UITextFields not editable?

1.1k Views Asked by At

I feel like I’m overlooking something basic. I’ve laid out a UIViewController as follows.

Interface Builder screen cap

I get no errors or warnings in Interface Builder, yet when I run the app in the simulator, the UITextView and red UIView do not appear. (Also, the UITextFields are not editable.)

enter image description here

I put a couple of NSLog’s at the end of viewDidLoad: and see that the UITextView and UIView are where I expect them to be:

2018-06-03 18:09:30.304537-0700 TestMe[37059:1239027] myTextView = {{48.5, 0}, {278, 60}}
2018-06-03 18:09:30.304876-0700 TestMe[37059:1239027] facebookView = {{52.5, 94.5}, {270, 80}}

They’re simply not visible. Why?

Here’s main.storyboard:

<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina4_7" orientation="portrait">
    <adaptation id="fullscreen"/>
</device>
<dependencies>
    <deployment identifier="iOS"/>
    <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
    <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
    <capability name="Safe area layout guides" minToolsVersion="9.0"/>
    <capability name="Stack View standard spacing" minToolsVersion="9.0"/>
    <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
    <!--View Controller-->
    <scene sceneID="tne-QT-ifu">
        <objects>
            <viewController id="BYZ-38-t0r" customClass="ViewController" customModule="TestMe" customModuleProvider="target" sceneMemberID="viewController">
                <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
                    <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                    <subviews>
                        <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="equalSpacing" alignment="center" spacingType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="efN-Uu-EM8">
                            <rect key="frame" x="0.0" y="40" width="375" height="587"/>
                            <subviews>
                                <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" text="Why does this text field disappear and the view below it?  I'm confused... very confused..." textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="uN2-2x-62N">
                                    <rect key="frame" x="48.5" y="0.0" width="278" height="60"/>
                                    <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                    <constraints>
                                        <constraint firstAttribute="height" constant="60" id="eD0-mv-hDl"/>
                                    </constraints>
                                    <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                    <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
                                </textView>
                                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="cQP-PE-x9G" userLabel="Facebook View">
                                    <rect key="frame" x="52.5" y="94.5" width="270" height="80"/>
                                    <color key="backgroundColor" red="1" green="0.1098039225" blue="0.14901961389999999" alpha="1" colorSpace="calibratedRGB"/>
                                    <constraints>
                                        <constraint firstAttribute="height" constant="80" id="mff-q6-fMf"/>
                                    </constraints>
                                </view>
                                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="8I8-cQ-10b" userLabel="Separator View">
                                    <rect key="frame" x="0.0" y="209" width="375" height="20"/>
                                    <subviews>
                                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="t6G-KG-jL8" userLabel="Separator">
                                            <rect key="frame" x="19" y="9" width="337.5" height="2"/>
                                            <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                            <constraints>
                                                <constraint firstAttribute="height" constant="2" id="zlr-In-RmU"/>
                                            </constraints>
                                        </view>
                                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" or " textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="M6X-pf-iz5">
                                            <rect key="frame" x="175" y="0.0" width="25" height="20.5"/>
                                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
                                            <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                            <nil key="textColor"/>
                                            <nil key="highlightedColor"/>
                                        </label>
                                    </subviews>
                                    <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                    <constraints>
                                        <constraint firstAttribute="height" constant="20" id="2Nu-OR-NmV"/>
                                        <constraint firstItem="M6X-pf-iz5" firstAttribute="centerX" secondItem="8I8-cQ-10b" secondAttribute="centerX" id="VOL-QV-LjO"/>
                                        <constraint firstItem="t6G-KG-jL8" firstAttribute="centerY" secondItem="8I8-cQ-10b" secondAttribute="centerY" id="YK8-Pj-sW5"/>
                                        <constraint firstItem="t6G-KG-jL8" firstAttribute="centerX" secondItem="8I8-cQ-10b" secondAttribute="centerX" id="w7y-2K-QxP"/>
                                        <constraint firstItem="M6X-pf-iz5" firstAttribute="centerY" secondItem="8I8-cQ-10b" secondAttribute="centerY" id="yyh-r9-Dmx"/>
                                    </constraints>
                                </view>
                                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Odz-UD-YHc">
                                    <rect key="frame" x="67.5" y="263.5" width="240" height="323.5"/>
                                    <subviews>
                                        <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="equalSpacing" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="A2n-PC-13u" userLabel="Login View">
                                            <rect key="frame" x="20" y="84" width="200" height="156"/>
                                            <subviews>
                                                <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="equalSpacing" alignment="center" spacingType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="TMi-iY-XF2">
                                                    <rect key="frame" x="0.0" y="0.0" width="200" height="106"/>
                                                    <subviews>
                                                        <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="email" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="sq9-kJ-uel">
                                                            <rect key="frame" x="0.0" y="0.0" width="200" height="30"/>
                                                            <constraints>
                                                                <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="200" id="DDC-lb-W1o"/>
                                                            </constraints>
                                                            <nil key="textColor"/>
                                                            <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                                            <textInputTraits key="textInputTraits" textContentType="email"/>
                                                        </textField>
                                                        <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="new password" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="jaX-Ys-zsJ">
                                                            <rect key="frame" x="0.0" y="38" width="200" height="30"/>
                                                            <nil key="textColor"/>
                                                            <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                                            <textInputTraits key="textInputTraits" textContentType="password"/>
                                                        </textField>
                                                        <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="retype password" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="Iki-yA-kWn">
                                                            <rect key="frame" x="0.0" y="76" width="200" height="30"/>
                                                            <nil key="textColor"/>
                                                            <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                                            <textInputTraits key="textInputTraits" textContentType="password"/>
                                                        </textField>
                                                    </subviews>
                                                    <constraints>
                                                        <constraint firstItem="Iki-yA-kWn" firstAttribute="width" secondItem="sq9-kJ-uel" secondAttribute="width" id="TV0-Fc-Zy6"/>
                                                        <constraint firstItem="jaX-Ys-zsJ" firstAttribute="width" secondItem="sq9-kJ-uel" secondAttribute="width" id="ueB-9T-rcU"/>
                                                    </constraints>
                                                </stackView>
                                                <button opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="252" verticalCompressionResistancePriority="748" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="bkQ-lZ-TGN">
                                                    <rect key="frame" x="0.0" y="126" width="200" height="30"/>
                                                    <color key="backgroundColor" red="0.89275385269999996" green="0.94806676079999996" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                                    <state key="normal" title="Create account"/>
                                                </button>
                                            </subviews>
                                        </stackView>
                                    </subviews>
                                    <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                    <constraints>
                                        <constraint firstItem="A2n-PC-13u" firstAttribute="centerX" secondItem="Odz-UD-YHc" secondAttribute="centerX" id="ECO-de-jMM"/>
                                        <constraint firstItem="A2n-PC-13u" firstAttribute="centerY" secondItem="Odz-UD-YHc" secondAttribute="centerY" id="uBG-6V-L4T"/>
                                    </constraints>
                                </view>
                            </subviews>
                            <constraints>
                                <constraint firstAttribute="trailing" secondItem="8I8-cQ-10b" secondAttribute="trailing" id="LOw-Vq-fCr"/>
                                <constraint firstItem="8I8-cQ-10b" firstAttribute="leading" secondItem="efN-Uu-EM8" secondAttribute="leading" id="dxM-bE-lPs"/>
                            </constraints>
                        </stackView>
                    </subviews>
                    <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                    <constraints>
                        <constraint firstItem="Odz-UD-YHc" firstAttribute="height" secondItem="6Tk-OE-BBY" secondAttribute="height" multiplier="0.5" id="1Cl-gZ-RGu"/>
                        <constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" secondItem="efN-Uu-EM8" secondAttribute="bottom" constant="40" id="2f9-c8-EJL"/>
                        <constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="efN-Uu-EM8" secondAttribute="trailing" id="7qG-T5-VCR"/>
                        <constraint firstItem="t6G-KG-jL8" firstAttribute="width" secondItem="6Tk-OE-BBY" secondAttribute="width" multiplier="0.9" id="9M3-cG-Ldp"/>
                        <constraint firstItem="efN-Uu-EM8" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="top" constant="40" id="PaP-tg-Ne3"/>
                        <constraint firstItem="efN-Uu-EM8" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" id="VXh-b8-3ay"/>
                    </constraints>
                    <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
                </view>
                <connections>
                    <outlet property="facebookView" destination="cQP-PE-x9G" id="LXX-lM-1tn"/>
                    <outlet property="myTextView" destination="uN2-2x-62N" id="coF-vZ-FrJ"/>
                </connections>
            </viewController>
            <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
        </objects>
    </scene>
</scenes>

I’m running Xcode 9.4 (9F1027a). Any help is greatly appreciated.

2

There are 2 best solutions below

1
On BEST ANSWER

You have not set top-bottom-leading-trailing-width-height constraint appropriately on each view so that the placement in compile is wrong and textfield is not editable as well because of it.

look at your code I have edited may be more easily understood

<objects>
                <viewController id="BYZ-38-t0r" customClass="ViewController" customModule="login" customModuleProvider="target" sceneMemberID="viewController">
                    <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                        <subviews>
                            <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="equalSpacing" alignment="center" spacingType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="efN-Uu-EM8">
                                <rect key="frame" x="0.0" y="40" width="375" height="587"/>
                                <subviews>
                                    <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" text="Why does this text field disappear and the view below it?  I'm confused... very confused..." textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="uN2-2x-62N">
                                        <rect key="frame" x="48.5" y="0.0" width="278" height="60"/>
                                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                        <constraints>
                                            <constraint firstAttribute="height" constant="60" id="eD0-mv-hDl"/>
                                        </constraints>
                                        <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                        <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
                                    </textView>
                                    <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="cQP-PE-x9G" userLabel="Facebook View">
                                        <rect key="frame" x="52.5" y="107" width="270" height="80"/>
                                        <color key="backgroundColor" red="1" green="0.1098039225" blue="0.14901961389999999" alpha="1" colorSpace="calibratedRGB"/>
                                        <constraints>
                                            <constraint firstAttribute="height" constant="80" id="mff-q6-fMf"/>
                                        </constraints>
                                    </view>
                                    <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="8I8-cQ-10b" userLabel="Separator View">
                                        <rect key="frame" x="0.0" y="234" width="375" height="20"/>
                                        <subviews>
                                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="t6G-KG-jL8" userLabel="Separator">
                                                <rect key="frame" x="19" y="9" width="338" height="2"/>
                                                <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                                <constraints>
                                                    <constraint firstAttribute="height" constant="2" id="zlr-In-RmU"/>
                                                </constraints>
                                            </view>
                                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" or " textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="M6X-pf-iz5">
                                                <rect key="frame" x="175" y="0.5" width="25" height="20.5"/>
                                                <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
                                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                <nil key="textColor"/>
                                                <nil key="highlightedColor"/>
                                            </label>
                                        </subviews>
                                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                        <constraints>
                                            <constraint firstAttribute="height" constant="20" id="2Nu-OR-NmV"/>
                                            <constraint firstItem="t6G-KG-jL8" firstAttribute="leading" secondItem="8I8-cQ-10b" secondAttribute="leading" constant="19" id="KmU-LN-V4W"/>
                                            <constraint firstItem="M6X-pf-iz5" firstAttribute="centerX" secondItem="8I8-cQ-10b" secondAttribute="centerX" id="VOL-QV-LjO"/>
                                            <constraint firstItem="t6G-KG-jL8" firstAttribute="centerY" secondItem="8I8-cQ-10b" secondAttribute="centerY" id="YK8-Pj-sW5"/>
                                            <constraint firstItem="t6G-KG-jL8" firstAttribute="centerX" secondItem="8I8-cQ-10b" secondAttribute="centerX" id="w7y-2K-QxP"/>
                                            <constraint firstItem="M6X-pf-iz5" firstAttribute="centerY" secondItem="8I8-cQ-10b" secondAttribute="centerY" id="yyh-r9-Dmx"/>
                                        </constraints>
                                    </view>
                                    <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Odz-UD-YHc">
                                        <rect key="frame" x="67.5" y="301" width="240" height="286"/>
                                        <subviews>
                                            <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="equalSpacing" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="A2n-PC-13u" userLabel="Login View">
                                                <rect key="frame" x="20" y="65.5" width="200" height="156"/>
                                                <subviews>
                                                    <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="equalSpacing" alignment="center" spacingType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="TMi-iY-XF2">
                                                        <rect key="frame" x="0.0" y="0.0" width="200" height="106"/>
                                                        <subviews>
                                                            <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="email" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="sq9-kJ-uel">
                                                                <rect key="frame" x="0.0" y="0.0" width="200" height="30"/>
                                                                <constraints>
                                                                    <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="200" id="DDC-lb-W1o"/>
                                                                </constraints>
                                                                <nil key="textColor"/>
                                                                <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                                                <textInputTraits key="textInputTraits" textContentType="email"/>
                                                            </textField>
                                                            <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="new password" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="jaX-Ys-zsJ">
                                                                <rect key="frame" x="0.0" y="38" width="200" height="30"/>
                                                                <nil key="textColor"/>
                                                                <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                                                <textInputTraits key="textInputTraits" textContentType="password"/>
                                                            </textField>
                                                            <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="retype password" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="Iki-yA-kWn">
                                                                <rect key="frame" x="0.0" y="76" width="200" height="30"/>
                                                                <nil key="textColor"/>
                                                                <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                                                <textInputTraits key="textInputTraits" textContentType="password"/>
                                                            </textField>
                                                        </subviews>
                                                        <constraints>
                                                            <constraint firstItem="Iki-yA-kWn" firstAttribute="width" secondItem="sq9-kJ-uel" secondAttribute="width" id="TV0-Fc-Zy6"/>
                                                            <constraint firstItem="jaX-Ys-zsJ" firstAttribute="width" secondItem="sq9-kJ-uel" secondAttribute="width" id="ueB-9T-rcU"/>
                                                        </constraints>
                                                    </stackView>
                                                    <button opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="252" verticalCompressionResistancePriority="748" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="bkQ-lZ-TGN">
                                                        <rect key="frame" x="0.0" y="126" width="200" height="30"/>
                                                        <color key="backgroundColor" red="0.89275385269999996" green="0.94806676079999996" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                                        <state key="normal" title="Create account"/>
                                                    </button>
                                                </subviews>
                                            </stackView>
                                        </subviews>
                                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                        <constraints>
                                            <constraint firstItem="A2n-PC-13u" firstAttribute="centerX" secondItem="Odz-UD-YHc" secondAttribute="centerX" id="ECO-de-jMM"/>
                                            <constraint firstAttribute="height" constant="286" id="rbx-xl-vgb"/>
                                            <constraint firstAttribute="width" constant="240" id="spR-bu-Zx0"/>
                                            <constraint firstItem="A2n-PC-13u" firstAttribute="centerY" secondItem="Odz-UD-YHc" secondAttribute="centerY" id="uBG-6V-L4T"/>
                                        </constraints>
                                    </view>
                                </subviews>
                                <constraints>
                                    <constraint firstItem="8I8-cQ-10b" firstAttribute="top" secondItem="cQP-PE-x9G" secondAttribute="bottom" constant="47" id="6eh-Ds-57M"/>
                                    <constraint firstAttribute="trailing" secondItem="uN2-2x-62N" secondAttribute="trailing" constant="48.5" id="7rd-h4-aIp"/>
                                    <constraint firstItem="cQP-PE-x9G" firstAttribute="top" secondItem="uN2-2x-62N" secondAttribute="bottom" constant="47" id="8gW-mV-6tW"/>
                                    <constraint firstAttribute="trailing" secondItem="8I8-cQ-10b" secondAttribute="trailing" id="LOw-Vq-fCr"/>
                                    <constraint firstItem="uN2-2x-62N" firstAttribute="leading" secondItem="efN-Uu-EM8" secondAttribute="leading" constant="48.5" id="Ot8-hl-xJo"/>
                                    <constraint firstItem="8I8-cQ-10b" firstAttribute="centerY" secondItem="efN-Uu-EM8" secondAttribute="centerY" constant="-50" id="P1h-Js-zjz"/>
                                    <constraint firstAttribute="bottom" secondItem="Odz-UD-YHc" secondAttribute="bottom" id="QT0-FI-0JI"/>
                                    <constraint firstItem="Odz-UD-YHc" firstAttribute="top" secondItem="8I8-cQ-10b" secondAttribute="bottom" constant="47" id="SsW-FE-H6c"/>
                                    <constraint firstItem="cQP-PE-x9G" firstAttribute="leading" secondItem="efN-Uu-EM8" secondAttribute="leading" constant="52.5" id="coV-Rh-6jK"/>
                                    <constraint firstItem="8I8-cQ-10b" firstAttribute="leading" secondItem="efN-Uu-EM8" secondAttribute="leading" id="dxM-bE-lPs"/>
                                    <constraint firstAttribute="trailing" secondItem="cQP-PE-x9G" secondAttribute="trailing" constant="52.5" id="fIf-qS-rMG"/>
                                    <constraint firstItem="uN2-2x-62N" firstAttribute="top" secondItem="efN-Uu-EM8" secondAttribute="top" id="nYZ-5b-P9P"/>
                                </constraints>
                            </stackView>
                        </subviews>
                        <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                        <constraints>
                            <constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" secondItem="efN-Uu-EM8" secondAttribute="bottom" constant="40" id="2f9-c8-EJL"/>
                            <constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="efN-Uu-EM8" secondAttribute="trailing" id="7qG-T5-VCR"/>
                            <constraint firstItem="efN-Uu-EM8" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="top" constant="40" id="PaP-tg-Ne3"/>
                            <constraint firstItem="efN-Uu-EM8" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" id="VXh-b8-3ay"/>
                        </constraints>
                        <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
                    </view>
                </viewController>
                <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
            </objects>

enter image description here hope this help.

0
On

After creating an example with a similar view hierarchy as yours I realized that since your text view and view with red background are missing width constraint they have zero width as runtime. Try giving width to both of them as equal to parent stack view and they will get rendered.

Also while working with vertical stack view it's not a good idea to give height constraint to subviews as the stack view itself creates some constraints for rendering its subviews and which may result in conflicting constraints at runtime. Refer to this link for more information.