From a4ab81899d9e5cff9cee336c25273a6256a7e53a Mon Sep 17 00:00:00 2001 From: Ilya Grechuhin Date: Wed, 14 Dec 2016 16:34:47 +0300 Subject: [PATCH 1/2] [search] [ios] Added automatic dimensions to search categories tab cells. --- .../MWMSearchCategoriesManager.mm | 18 +++++----------- .../CategoriesTab/MWMSearchCategoryCell.xib | 21 ++++++++++++------- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/CategoriesTab/MWMSearchCategoriesManager.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/CategoriesTab/MWMSearchCategoriesManager.mm index 51ce5023c3..8a9b0dbbd2 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/CategoriesTab/MWMSearchCategoriesManager.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/CategoriesTab/MWMSearchCategoriesManager.mm @@ -27,6 +27,8 @@ static NSString * const kCellIdentifier = @"MWMSearchCategoryCell"; { [cell removeNoResultsView]; UITableView * tableView = cell.tableView; + tableView.estimatedRowHeight = 44.; + tableView.rowHeight = UITableViewAutomaticDimension; tableView.alpha = 1.0; tableView.hidden = NO; tableView.delegate = self; @@ -46,23 +48,13 @@ static NSString * const kCellIdentifier = @"MWMSearchCategoryCell"; - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - return [tableView dequeueReusableCellWithIdentifier:kCellIdentifier]; + auto tCell = static_cast([tableView dequeueReusableCellWithIdentifier:kCellIdentifier]); + [tCell setCategory:@(m_categories[indexPath.row].c_str())]; + return tCell; } #pragma mark - UITableViewDelegate -- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath -{ - return 44.0; -} - -- (void)tableView:(UITableView *)tableView - willDisplayCell:(MWMSearchCategoryCell *)cell - forRowAtIndexPath:(NSIndexPath *)indexPath -{ - [cell setCategory:@(m_categories[indexPath.row].c_str())]; -} - - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSString * string = @(m_categories[indexPath.row].c_str()); diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/CategoriesTab/MWMSearchCategoryCell.xib b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/CategoriesTab/MWMSearchCategoryCell.xib index 49cddac129..9b10497fc2 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/CategoriesTab/MWMSearchCategoryCell.xib +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/Search/TabbedView/CategoriesTab/MWMSearchCategoryCell.xib @@ -1,8 +1,12 @@ - - + + + + + - + + @@ -22,8 +26,8 @@ - - + + @@ -31,10 +35,10 @@ -