From 8a75defee993a4aecf4865e1460aab193d3a2d2e Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Wed, 18 Mar 2020 16:06:05 -0500 Subject: [PATCH] Set row height when table is empty and set to automatic when articles are present. Issue #1919 --- iOS/MasterTimeline/MasterTimelineViewController.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/iOS/MasterTimeline/MasterTimelineViewController.swift b/iOS/MasterTimeline/MasterTimelineViewController.swift index 0abe0d939..87563f9f2 100644 --- a/iOS/MasterTimeline/MasterTimelineViewController.swift +++ b/iOS/MasterTimeline/MasterTimelineViewController.swift @@ -630,10 +630,16 @@ private extension MasterTimelineViewController { } func applyChanges(animated: Bool, completion: (() -> Void)? = nil) { + if coordinator.articles.count == 0 { + tableView.rowHeight = tableView.estimatedRowHeight + } else { + tableView.rowHeight = UITableView.automaticDimension + } + var snapshot = NSDiffableDataSourceSnapshot() snapshot.appendSections([0]) snapshot.appendItems(coordinator.articles, toSection: 0) - + dataSource.apply(snapshot, animatingDifferences: animated) { [weak self] in self?.restoreSelectionIfNecessary(adjustScroll: false) completion?()