Skip to content

Commit 6f44e0f

Browse files
authored
Merge pull request #738 from Iterable/Finalizing-Constraints-2
2 parents 93bbbc9 + 7154a2d commit 6f44e0f

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

swift-sdk/Resources/IterableEmbeddedView.xib

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@
3434
<rect key="frame" x="0.0" y="0.0" width="400" height="416"/>
3535
<subviews>
3636
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="WQD-hj-6fI">
37-
<rect key="frame" x="0.0" y="0.0" width="400" height="0.0"/>
37+
<rect key="frame" x="0.0" y="0.0" width="400" height="12"/>
3838
</imageView>
39-
<stackView opaque="NO" contentMode="scaleToFill" alignment="center" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="0Q3-lN-ixZ">
39+
<stackView opaque="NO" contentMode="scaleToFill" alignment="top" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="0Q3-lN-ixZ">
4040
<rect key="frame" x="16" y="16" width="368" height="333.66666666666669"/>
4141
<subviews>
42-
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="top" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="fVi-s9-EJr">
43-
<rect key="frame" x="0.0" y="132" width="260" height="70"/>
42+
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="top" spacing="-4" translatesAutoresizingMaskIntoConstraints="NO" id="fVi-s9-EJr">
43+
<rect key="frame" x="0.0" y="0.0" width="260" height="62"/>
4444
<subviews>
4545
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="750" verticalCompressionResistancePriority="1000" text="Title Text" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YhJ-Xr-beZ">
4646
<rect key="frame" x="0.0" y="0.0" width="89.666666666666671" height="25.333333333333332"/>
@@ -49,17 +49,21 @@
4949
<nil key="highlightedColor"/>
5050
</label>
5151
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalCompressionResistancePriority="1000" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jZp-8m-qQK">
52-
<rect key="frame" x="0.0" y="29.333333333333339" width="120.33333333333333" height="40.666666666666657"/>
52+
<rect key="frame" x="0.0" y="21.333333333333339" width="120.33333333333333" height="40.666666666666657"/>
5353
<string key="text">Description text
5454
Description text</string>
5555
<fontDescription key="fontDescription" type="system" pointSize="17"/>
5656
<nil key="textColor"/>
5757
<nil key="highlightedColor"/>
5858
</label>
5959
</subviews>
60+
<constraints>
61+
<constraint firstAttribute="trailing" relation="lessThanOrEqual" secondItem="YhJ-Xr-beZ" secondAttribute="trailing" constant="170.33333333333331" id="0dY-bW-PIW"/>
62+
<constraint firstAttribute="trailing" relation="lessThanOrEqual" secondItem="jZp-8m-qQK" secondAttribute="trailing" constant="139.66666666666669" id="XHy-qF-kvs"/>
63+
</constraints>
6064
</stackView>
6165
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="k84-x3-9VM">
62-
<rect key="frame" x="268" y="117" width="100" height="100"/>
66+
<rect key="frame" x="268" y="0.0" width="100" height="100"/>
6367
<constraints>
6468
<constraint firstAttribute="height" constant="100" id="8cm-im-EKi"/>
6569
<constraint firstAttribute="width" constant="100" id="bVg-Ev-iLm"/>
@@ -106,7 +110,7 @@ Description text</string>
106110
<constraint firstItem="0Q3-lN-ixZ" firstAttribute="leading" secondItem="W3z-UY-cBI" secondAttribute="leading" constant="16" id="CYI-wT-5Bu"/>
107111
<constraint firstItem="0Q3-lN-ixZ" firstAttribute="top" secondItem="W3z-UY-cBI" secondAttribute="top" constant="16" id="GlZ-AF-Kcz"/>
108112
<constraint firstItem="bou-qy-tfe" firstAttribute="top" secondItem="0Q3-lN-ixZ" secondAttribute="bottom" constant="16" id="Jws-n4-1t0"/>
109-
<constraint firstItem="0Q3-lN-ixZ" firstAttribute="top" secondItem="WQD-hj-6fI" secondAttribute="bottom" constant="16" id="QPV-u9-oRb"/>
113+
<constraint firstItem="0Q3-lN-ixZ" firstAttribute="top" secondItem="WQD-hj-6fI" secondAttribute="bottom" constant="4" id="QPV-u9-oRb"/>
110114
<constraint firstItem="WQD-hj-6fI" firstAttribute="leading" secondItem="W3z-UY-cBI" secondAttribute="leading" id="SFv-hm-aAU"/>
111115
<constraint firstAttribute="trailing" secondItem="bou-qy-tfe" secondAttribute="trailing" constant="16" id="ZOK-GY-gwh"/>
112116
<constraint firstItem="bou-qy-tfe" firstAttribute="leading" secondItem="W3z-UY-cBI" secondAttribute="leading" constant="16" id="bfg-f5-ujR"/>

swift-sdk/uicomponents/IterableEmbeddedView.swift

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,11 @@ public class IterableEmbeddedView:UIView {
198198
contentView.leadingAnchor.constraint(equalTo: self.leadingAnchor),
199199
contentView.trailingAnchor.constraint(equalTo: self.trailingAnchor)
200200
])
201+
202+
buttonStackView.heightAnchor.constraint(equalToConstant: primaryBtn.frame.height).isActive = true
203+
labelTitle.heightAnchor.constraint(equalToConstant: labelTitle.frame.height * 2).isActive = true
204+
labelDescription.heightAnchor.constraint(equalToConstant: labelDescription.frame.height).isActive = true
201205
}
202-
203-
// func loadViewFromNib() -> UIView? {
204-
// let nib = UINib(nibName: "IterableEmbeddedView", bundle: Bundle.module)
205-
// let view = nib.instantiate(withOwner: self, options: nil).first as? UIView
206-
// self.clipsToBounds = false
207-
// return view
208-
// }
209206

210207
func loadViewFromNib() -> UIView? {
211208
var nib: UINib

0 commit comments

Comments
 (0)