Skip to content

Commit bb1e722

Browse files
committed
Update table view style to grouped
1 parent a870d83 commit bb1e722

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

WooCommerce/Classes/ViewRelated/Orders/OrderStatusListViewController.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,16 @@ final class OrderStatusListViewController: UIViewController {
9898
//
9999
extension OrderStatusListViewController {
100100
func configureNavigationBar() {
101+
configureNavigationBarStyle()
101102
configureTitle()
102103
configureLeftButton()
103104
configureRightButton()
104105
}
105106

107+
func configureNavigationBarStyle() {
108+
navigationController?.navigationBar.barStyle = .black
109+
}
110+
106111
func configureTitle() {
107112
title = NSLocalizedString("Order Status", comment: "Change order status screen - Screen title")
108113
}
@@ -196,6 +201,10 @@ private extension OrderStatusListViewController {
196201
// MARK: - UITableViewDatasource conformance
197202
//
198203
extension OrderStatusListViewController: UITableViewDataSource {
204+
func numberOfSections(in tableView: UITableView) -> Int {
205+
return statusResultsController.sections.count
206+
}
207+
199208
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
200209
return statusResultsController.sections[section].numberOfObjects
201210
}
@@ -217,6 +226,11 @@ extension OrderStatusListViewController: UITableViewDataSource {
217226
// MARK: - UITableViewDelegate conformance
218227
//
219228
extension OrderStatusListViewController: UITableViewDelegate {
229+
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
230+
// iOS 11 table bug. Must return a tiny value to collapse `nil` or `empty` section headers.
231+
return CGFloat.leastNonzeroMagnitude
232+
}
233+
220234
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
221235
selectedStatus = statusResultsController.object(at: indexPath)
222236
}
@@ -235,6 +249,7 @@ extension OrderStatusListViewController {
235249

236250
AppDelegate.shared.noticePresenter.enqueue(notice: notice)
237251
}
252+
238253
/// Displays the `Unable to Change Status of Order` Notice.
239254
///
240255
func displayErrorNotice(orderID: Int) {

WooCommerce/Classes/ViewRelated/Orders/OrderStatusListViewController.xib

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
2222
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
2323
<subviews>
24-
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="nub-3J-oyN">
24+
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="nub-3J-oyN">
2525
<rect key="frame" x="0.0" y="64" width="375" height="603"/>
26-
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
26+
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
2727
</tableView>
2828
</subviews>
2929
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>

0 commit comments

Comments
 (0)