From 51acc5972f04c378885b496193f82ef67fca2fec Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Wed, 30 Oct 2019 16:08:03 -0500 Subject: [PATCH] Prevent the search bar from appearing on rotation. Issue #1171 --- 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 03b8d7ba0..61103ed05 100644 --- a/iOS/MasterTimeline/MasterTimelineViewController.swift +++ b/iOS/MasterTimeline/MasterTimelineViewController.swift @@ -57,7 +57,6 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner NSLocalizedString("Here", comment: "Here"), NSLocalizedString("All Articles", comment: "All Articles") ] - navigationItem.searchController = searchController definesPresentationContext = true // Configure the table @@ -74,6 +73,13 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner super.viewWillAppear(animated) } + override func viewWillLayoutSubviews() { + super.viewWillLayoutSubviews() + // You have to assign the search controller here to avoid showing it by default + // https://stackoverflow.com/questions/57581557/how-to-initally-hide-searchbar-in-navigation-controller-on-ios-13 + navigationItem.searchController = searchController + } + // MARK: Actions @IBAction func markAllAsRead(_ sender: Any) {