From f01fb281ec0848d1e7d87461a225b91f94a90f9c Mon Sep 17 00:00:00 2001 From: Ilya Grechuhin Date: Tue, 15 Sep 2015 13:03:55 +0300 Subject: [ios] Changed initial tab selection logic. --- .../CustomViews/MapViewControls/Search/MWMSearchManager.mm | 2 +- .../Search/TabbedView/MWMSearchTabbedViewController.h | 2 +- .../Search/TabbedView/MWMSearchTabbedViewController.mm | 10 +++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) (limited to 'iphone') diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/MWMSearchManager.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/MWMSearchManager.mm index 9f6f5315a0..e723622d35 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/MWMSearchManager.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/MWMSearchManager.mm @@ -208,7 +208,7 @@ extern NSString * const kAlohalyticsTapEventKey; { [self endSearch]; GetFramework().GetCountryTree().GetActiveMapLayout().RemoveListener(m_mapsObserverSlotId); - self.tabbedController.selectedButtonTag = 0; + [self.tabbedController resetSelectedTab]; self.tableViewController = nil; self.downloadController = nil; self.rootView.isVisible = NO; diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/MWMSearchTabbedViewController.h b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/MWMSearchTabbedViewController.h index 3bd969e9a4..09076d503d 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/MWMSearchTabbedViewController.h +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/MWMSearchTabbedViewController.h @@ -7,8 +7,8 @@ @property (weak, nonatomic) NSLayoutConstraint * scrollIndicatorOffset; @property (weak, nonatomic) UIView * scrollIndicator; @property (weak, nonatomic) id delegate; -@property (nonatomic) NSInteger selectedButtonTag; - (void)tabButtonPressed:(MWMSearchTabButtonsView *)sender; +- (void)resetSelectedTab; @end diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/MWMSearchTabbedViewController.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/MWMSearchTabbedViewController.mm index 57162068fd..8149786a93 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/MWMSearchTabbedViewController.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/MWMSearchTabbedViewController.mm @@ -6,6 +6,8 @@ #import "MWMSearchTabbedViewProtocol.h" #import "UIKitCategories.h" +#include "Framework.h" + static NSString * const kCollectionCell = @"MWMSearchTabbedCollectionViewCell"; typedef NS_ENUM(NSInteger, MWMSearchTabbedViewCell) @@ -33,6 +35,7 @@ BOOL isOffsetInButton(CGFloat offset, MWMSearchTabButtonsView * button) @property (nonatomic) MWMSearchCategoriesManager * categoriesManager; @property (nonatomic) BOOL isRotating; +@property (nonatomic) NSInteger selectedButtonTag; @end @@ -50,7 +53,12 @@ BOOL isOffsetInButton(CGFloat offset, MWMSearchTabButtonsView * button) { [super viewDidLoad]; [self setupCollectionView]; - self.selectedButtonTag = 0; + [self resetSelectedTab]; +} + +- (void)resetSelectedTab +{ + self.selectedButtonTag = GetFramework().GetLastSearchQueries().empty() ? 1 : 0; } - (void)viewWillAppear:(BOOL)animated -- cgit v1.2.3