From 63fb4b6c76961f4b924fb3e9edc84055ed635d22 Mon Sep 17 00:00:00 2001 From: VladiMihaylenko Date: Fri, 11 Mar 2016 17:44:51 +0300 Subject: [PATCH] [ios] Editor bugfix. --- .../Classes/Editor/MWMEditorViewController.mm | 2 +- .../MWMObjectsCategorySelectorController.mm | 23 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/iphone/Maps/Classes/Editor/MWMEditorViewController.mm b/iphone/Maps/Classes/Editor/MWMEditorViewController.mm index 82958e06e8..4e5e00741b 100644 --- a/iphone/Maps/Classes/Editor/MWMEditorViewController.mm +++ b/iphone/Maps/Classes/Editor/MWMEditorViewController.mm @@ -210,7 +210,7 @@ NSString * reuseIdentifier(MWMPlacePageCellType cellType) case MWMPlacePageCellTypeStreet: return m_mapObject.IsAddressEditable(); case MWMPlacePageCellTypeBuilding: return m_mapObject.IsAddressEditable(); case MWMPlacePageCellTypeCategory: return self.isCreating; - default: NSAssert(false, @"Invalid cell type %d", cellType); return false; + default: NSAssert(false, @"Invalid cell type %@", @(cellType)); return false; } } diff --git a/iphone/Maps/Classes/Editor/MWMObjectsCategorySelectorController.mm b/iphone/Maps/Classes/Editor/MWMObjectsCategorySelectorController.mm index c549b6bcb9..29e3fc91d9 100644 --- a/iphone/Maps/Classes/Editor/MWMObjectsCategorySelectorController.mm +++ b/iphone/Maps/Classes/Editor/MWMObjectsCategorySelectorController.mm @@ -41,7 +41,7 @@ namespace [self configSearchBar]; } -- (void)setSelectedCategory:(const string &)category +- (void)setSelectedCategory:(string const &)category { m_categories = GetFramework().GetEditorCategories(); auto const & all = m_categories.m_allSorted; @@ -67,11 +67,6 @@ namespace - (void)configNavBar { self.title = L(@"feature_type").capitalizedString; - if (!self.selectedIndexPath) - { - self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:L(@"done") - style:UIBarButtonItemStyleDone target:self action:@selector(onDone)]; - } } - (void)configSearchBar @@ -123,7 +118,6 @@ namespace cell.textLabel.textColor = [UIColor blackPrimaryText]; cell.backgroundColor = [UIColor white]; cell.textLabel.text = @([self dataSourceForSection:indexPath.section][indexPath.row].m_name.c_str()); - cell.selectionStyle = UITableViewCellSelectionStyleNone; if ([indexPath isEqual:self.selectedIndexPath]) cell.accessoryType = UITableViewCellAccessoryCheckmark; else @@ -133,11 +127,12 @@ namespace - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - UITableViewCell * selectedCell = [tableView cellForRowAtIndexPath:self.selectedIndexPath]; - selectedCell.accessoryType = UITableViewCellAccessoryNone; - selectedCell = [self.tableView cellForRowAtIndexPath:indexPath]; - selectedCell.accessoryType = UITableViewCellAccessoryCheckmark; self.selectedIndexPath = indexPath; + + if (self.delegate) + [self backTap]; + else + [self performSegueWithIdentifier:kToEditorSegue sender:nil]; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView @@ -203,13 +198,17 @@ namespace - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar { [self searchBar:searchBar setActiveState:YES]; + self.isSearch = NO; return YES; } - (BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar { if (!searchBar.text.length) + { [self searchBar:searchBar setActiveState:NO]; + self.isSearch = NO; + } return YES; } @@ -218,6 +217,7 @@ namespace [searchBar resignFirstResponder]; searchBar.text = @""; [self searchBar:searchBar setActiveState:NO]; + self.isSearch = NO; [self.tableView reloadData]; } @@ -235,7 +235,6 @@ namespace { [searchBar setShowsCancelButton:isActiveState animated:YES]; [self.navigationController setNavigationBarHidden:isActiveState animated:YES]; - self.isSearch = isActiveState; if (!isActiveState) m_filteredCategories.clear(); }