From 8f71474b034ace4f20d30d86cf943c472668de88 Mon Sep 17 00:00:00 2001 From: Brad Brown Date: Thu, 13 Jul 2017 16:48:49 -0400 Subject: [PATCH] Adding style configuration to configure how the search bar interacts with navigation --- Classes/UVStyleSheet.m | 2 ++ Classes/UVSuggestionListViewController.m | 2 +- Classes/UVWelcomeViewController.m | 6 +++--- Include/UVStyleSheet.h | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Classes/UVStyleSheet.m b/Classes/UVStyleSheet.m index e9b19d14..0aa965ef 100755 --- a/Classes/UVStyleSheet.m +++ b/Classes/UVStyleSheet.m @@ -19,7 +19,9 @@ + (UVStyleSheet *)instance { instance.preferredStatusBarStyle = UIStatusBarStyleDefault; instance.navigationBarTintColor = [UINavigationBar appearance].tintColor; instance.navigationBarTranslucency = YES; + instance.searchBarHideNavigation = true; } + return instance; } diff --git a/Classes/UVSuggestionListViewController.m b/Classes/UVSuggestionListViewController.m index 982071df..0e095c98 100644 --- a/Classes/UVSuggestionListViewController.m +++ b/Classes/UVSuggestionListViewController.m @@ -220,7 +220,7 @@ - (void)loadView { _searchController.searchResultsUpdater = self; _searchController.searchBar.delegate = self; _searchController.searchBar.placeholder = NSLocalizedStringFromTableInBundle(@"Search forum", @"UserVoice", [UserVoice bundle], nil); - if (FORMSHEET) { + if (FORMSHEET || ![UVStyleSheet instance].searchBarHideNavigation) { _searchController.hidesNavigationBarDuringPresentation = false; } diff --git a/Classes/UVWelcomeViewController.m b/Classes/UVWelcomeViewController.m index cb4ba57e..c01ddd99 100644 --- a/Classes/UVWelcomeViewController.m +++ b/Classes/UVWelcomeViewController.m @@ -322,9 +322,9 @@ - (void)loadView { if ([UVSession currentSession].config.showForum ) { _searchController.searchBar.scopeButtonTitles = @[NSLocalizedStringFromTableInBundle(@"All", @"UserVoice", [UserVoice bundle], nil), NSLocalizedStringFromTableInBundle(@"Articles", @"UserVoice", [UserVoice bundle], nil), NSLocalizedStringFromTableInBundle(@"Ideas", @"UserVoice", [UserVoice bundle], nil)]; } - - if (FORMSHEET) { - _searchController.hidesNavigationBarDuringPresentation = NO; + + if (FORMSHEET || ![UVStyleSheet instance].searchBarHideNavigation) { + _searchController.hidesNavigationBarDuringPresentation = false; } _tableView.tableHeaderView = _searchController.searchBar; diff --git a/Include/UVStyleSheet.h b/Include/UVStyleSheet.h index 43f3986a..96131186 100755 --- a/Include/UVStyleSheet.h +++ b/Include/UVStyleSheet.h @@ -25,5 +25,6 @@ @property (nonatomic, assign) BOOL navigationBarTranslucency; @property (nonatomic, retain) UIColor *loadingViewBackgroundColor; @property (nonatomic, assign) UIStatusBarStyle preferredStatusBarStyle; +@property (nonatomic, assign) BOOL searchBarHideNavigation; @end