Skip to content

Commit 239cf55

Browse files
committed
Add a constant to the Product List cell, remove constants for section header & footer heights
1 parent b8eb279 commit 239cf55

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

WooCommerce/Classes/ViewRelated/Orders/OrderDetails/OrderDetailsViewController.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ class OrderDetailsViewController: UIViewController {
3232
}
3333

3434
func configureTableView() {
35+
tableView.estimatedSectionHeaderHeight = Constants.sectionHeight
36+
tableView.estimatedSectionFooterHeight = Constants.rowHeight
3537
tableView.estimatedRowHeight = Constants.rowHeight
3638
tableView.rowHeight = UITableViewAutomaticDimension
3739
configureSections()
@@ -111,7 +113,7 @@ extension OrderDetailsViewController: UITableViewDataSource {
111113
return CGFloat.leastNonzeroMagnitude
112114
}
113115

114-
return Constants.sectionHeight
116+
return UITableViewAutomaticDimension
115117
}
116118

117119
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
@@ -134,7 +136,7 @@ extension OrderDetailsViewController: UITableViewDataSource {
134136
return CGFloat.leastNonzeroMagnitude
135137
}
136138

137-
return Constants.rowHeight
139+
return UITableViewAutomaticDimension
138140
}
139141

140142
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {

WooCommerce/Classes/ViewRelated/Orders/OrderDetails/ProductListTableViewCell.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ extension ProductListTableViewCell {
2828
fulfillButton.setTitle(viewModel.fulfillTitle, for: .normal)
2929
fulfillButton.applyFilledRoundStyle()
3030

31-
verticalStackView.setCustomSpacing(8.0, after: fulfillButton)
31+
verticalStackView.setCustomSpacing(Constants.spacing, after: fulfillButton)
32+
}
33+
34+
struct Constants {
35+
static let spacing = CGFloat(8.0)
3236
}
3337
}

WooCommerce/Classes/ViewRelated/ReusableViews/TwoColumnSectionHeaderView.xib

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
33
<device id="retina4_7" orientation="portrait">
44
<adaptation id="fullscreen"/>
55
</device>
@@ -15,13 +15,13 @@
1515
<rect key="frame" x="0.0" y="0.0" width="375" height="32"/>
1616
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
1717
<subviews>
18-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nAe-82-c1s">
18+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nAe-82-c1s">
1919
<rect key="frame" x="317" y="3.5" width="42" height="20.5"/>
2020
<fontDescription key="fontDescription" type="system" pointSize="17"/>
2121
<nil key="textColor"/>
2222
<nil key="highlightedColor"/>
2323
</label>
24-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4Fd-ta-Azy">
24+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4Fd-ta-Azy">
2525
<rect key="frame" x="16" y="3.5" width="42" height="20.5"/>
2626
<fontDescription key="fontDescription" type="system" pointSize="17"/>
2727
<nil key="textColor"/>

0 commit comments

Comments
 (0)