From fcf6fc46a4c2a77146f1f91c95bdf80910942e90 Mon Sep 17 00:00:00 2001 From: Chris Li Date: Wed, 4 Jan 2017 23:37:59 -0500 Subject: [PATCH] hide search bar when show search --- Kiwix-iOS/Controller/Main/MainDelegates.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Kiwix-iOS/Controller/Main/MainDelegates.swift b/Kiwix-iOS/Controller/Main/MainDelegates.swift index b4344e16..9b121afd 100644 --- a/Kiwix-iOS/Controller/Main/MainDelegates.swift +++ b/Kiwix-iOS/Controller/Main/MainDelegates.swift @@ -81,6 +81,8 @@ extension MainController: SearchBarDelegate, SearchContainerDelegate { controller.delegate = self guard !childViewControllers.contains(controller) else {return} + navigationController?.setToolbarHidden(true, animated: animated) + // add cancel button if needed if traitCollection.horizontalSizeClass == .compact { navigationItem.setRightBarButton(buttons.cancel, animated: animated) @@ -111,6 +113,8 @@ extension MainController: SearchBarDelegate, SearchContainerDelegate { private func hideSearch(animated: Bool) { guard let searchController = childViewControllers.flatMap({$0 as? SearchContainer}).first else {return} + navigationController?.setToolbarHidden(false, animated: animated) + // remove cancel button if needed if traitCollection.horizontalSizeClass == .compact { navigationItem.setRightBarButton(nil, animated: animated)