下面是我为我的故事板准备的XAML:
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="equalCentering" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="Zbh-CC-wDS" misplaced="YES">
<rect key="frame" x="107" y="294" width="200" height="188"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="splash_image.png" translatesAutoresizingMaskIntoConstraints="NO" id="znN-uk-H0B" misplaced="YES">
<rect key="frame" x="36" y="0.0" width="128" height="80"/>
<constraints>
<constraint firstAttribute="height" constant="80" id="A2X-j1-ymP"/>
</constraints>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BWy-bZ-hd4">
<rect key="frame" x="0.0" y="80" width="200" height="50"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251"
text="ABC" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO"
id="EcF-nC-k2o" colorLabel="IBBuiltInLabel-Gray">
<rect key="frame" x="36" y="152" width="128" height="36"/>
<fontDescription key="fontDescription" type="system" pointSize="30"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>设计人员创建了一个:
View Controller
Safe Area
Stack View
spash_image.png
View
XXX是否有一种方法可以代替用View来提供图像和标签之间的距离,我可以使用其他的东西。也许在某种程度上增加了垂直约束。
如有任何建议,我将不胜感激
发布于 2020-06-05 06:43:20
选择StackView,您将在属性检查器中看到Spacing选项。将其设置为10-20或任何您想要的值。

https://stackoverflow.com/questions/62209395
复制相似问题