From 4f401099b63e3d1128bbac38577c5a43743a3904 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Sat, 14 Sep 2019 19:51:23 -0500 Subject: [PATCH] Fix empty space that sometimes appeared between the first section and the navigation bar of Feeds --- iOS/MasterFeed/MasterFeedViewController.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index 03b7de0f4..61a9ce8d0 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -41,6 +41,12 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner { navigationItem.rightBarButtonItem = editButtonItem + // If you don't have an empty table header, UIKit tries to help out by putting one in for you + // that makes a gap between the first section header and the navigation bar + var frame = CGRect.zero + frame.size.height = .leastNormalMagnitude + tableView.tableHeaderView = UIView(frame: frame) + tableView.register(MasterFeedTableViewSectionHeader.self, forHeaderFooterViewReuseIdentifier: "SectionHeader") tableView.dataSource = dataSource