Skip to content

Commit

Permalink
Add default top and bottom padding of 1
Browse files Browse the repository at this point in the history
  • Loading branch information
levieggertcru committed Jan 22, 2025
1 parent 11e0fb5 commit 944c5a0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class MobileContentTextView: MobileContentView, NibBased {
}

private static let defaultNumberOfLines: Int = 0
private static let textTopPadding: CGFloat = 1
private static let textBottomPadding: CGFloat = 1

private let viewType: ViewType
private let additionalLabelAttributes: MobileContentTextLabelAttributes?
Expand All @@ -29,6 +31,8 @@ class MobileContentTextView: MobileContentView, NibBased {
@IBOutlet weak private var startImageViewLeading: NSLayoutConstraint!
@IBOutlet weak private var startImageViewWidth: NSLayoutConstraint!
@IBOutlet weak private var startImageViewHeight: NSLayoutConstraint!
@IBOutlet weak private var textLabelTop: NSLayoutConstraint!
@IBOutlet weak private var textLabelBottom: NSLayoutConstraint!
@IBOutlet weak private var textLabelLeading: NSLayoutConstraint!
@IBOutlet weak private var textLabelTrailing: NSLayoutConstraint!
@IBOutlet weak private var endImageViewTrailing: NSLayoutConstraint!
Expand Down Expand Up @@ -61,7 +65,10 @@ class MobileContentTextView: MobileContentView, NibBased {
if shouldAddLabelAsSubview {
addSubview(label)
label.translatesAutoresizingMaskIntoConstraints = false
label.constrainEdgesToView(view: self, edgeInsets: .zero)
label.constrainEdgesToView(
view: self,
edgeInsets: UIEdgeInsets(top: Self.textTopPadding, left: 0, bottom: Self.textBottomPadding, right: 0)
)
}
self.textLabel = label
case .loadFromNib:
Expand Down Expand Up @@ -147,6 +154,9 @@ class MobileContentTextView: MobileContentView, NibBased {
startImageView.isHidden = hidesStartImage
endImageView.isHidden = hidesEndImage

textLabelTop.constant = Self.textTopPadding
textLabelBottom.constant = Self.textBottomPadding

if hidesStartImage {

startImageViewLeading.constant = hiddenImageSize * -1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand All @@ -19,7 +19,9 @@
<outlet property="startImageViewLeading" destination="sV6-lM-MJH" id="Dsy-hp-jc2"/>
<outlet property="startImageViewWidth" destination="81v-ld-Fnn" id="Qmz-Xv-IN3"/>
<outlet property="textLabel" destination="7ab-u2-cmn" id="17d-9b-dfk"/>
<outlet property="textLabelBottom" destination="JVP-bn-Ifp" id="w0l-cj-OCl"/>
<outlet property="textLabelLeading" destination="t9M-QZ-1Z2" id="e4K-5s-sJ5"/>
<outlet property="textLabelTop" destination="VCo-F6-DhX" id="qMO-1w-LfK"/>
<outlet property="textLabelTrailing" destination="C27-7d-JX0" id="LWr-38-ulp"/>
</connections>
</placeholder>
Expand Down

0 comments on commit 944c5a0

Please sign in to comment.