diff options
author | Ilya Grechuhin <i.grechuhin@gmail.com> | 2016-12-14 16:34:47 +0300 |
---|---|---|
committer | Ilya Grechuhin <i.grechuhin@gmail.com> | 2016-12-14 16:34:47 +0300 |
commit | a4ab81899d9e5cff9cee336c25273a6256a7e53a (patch) | |
tree | a9affc54f383a1c733a4d929ff0c3957cd11728e /iphone/Maps | |
parent | 46c814196674846637dc95ddf48a010325e544ec (diff) |
[search] [ios] Added automatic dimensions to search categories tab cells.
Diffstat (limited to 'iphone/Maps')
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<MWMSearchCategoryCell *>([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 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES"> +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> + <device id="retina4_7" orientation="portrait"> + <adaptation id="fullscreen"/> + </device> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <objects> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> @@ -22,8 +26,8 @@ </constraints> </imageView> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="WO3-AY-H0S" userLabel="Separator"> - <rect key="frame" x="60" y="43" width="260" height="1"/> - <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="calibratedRGB"/> + <rect key="frame" x="60" y="42" width="260" height="1"/> + <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/> <constraints> <constraint firstAttribute="height" constant="1" id="W6j-8r-VpK"/> </constraints> @@ -31,10 +35,10 @@ <userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="blackDividers"/> </userDefinedRuntimeAttributes> </view> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Food" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ACg-C3-HtA" userLabel="Category label"> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Food" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ACg-C3-HtA" userLabel="Category label"> <rect key="frame" x="60" y="12" width="244" height="20"/> <fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="17"/> - <color key="textColor" red="0.12941176469999999" green="0.12941176469999999" blue="0.12941176469999999" alpha="1" colorSpace="calibratedRGB"/> + <color key="textColor" red="0.12941176469999999" green="0.12941176469999999" blue="0.12941176469999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular17"/> @@ -46,11 +50,12 @@ <constraint firstAttribute="centerY" secondItem="Enr-Zg-Z5s" secondAttribute="centerY" id="1q9-qQ-crG"/> <constraint firstAttribute="bottom" secondItem="WO3-AY-H0S" secondAttribute="bottom" id="4A4-Tc-rGy"/> <constraint firstAttribute="trailing" secondItem="WO3-AY-H0S" secondAttribute="trailing" id="9AW-4d-CWP"/> + <constraint firstAttribute="bottom" secondItem="ACg-C3-HtA" secondAttribute="bottom" constant="11" id="ALN-MG-O9u"/> <constraint firstAttribute="trailing" secondItem="ACg-C3-HtA" secondAttribute="trailing" constant="16" id="CG1-fx-Dcg"/> <constraint firstItem="WO3-AY-H0S" firstAttribute="leading" secondItem="Enr-Zg-Z5s" secondAttribute="trailing" constant="16" id="c0m-Qo-lBf"/> - <constraint firstAttribute="centerY" secondItem="ACg-C3-HtA" secondAttribute="centerY" id="fS6-QL-LXH"/> <constraint firstItem="Enr-Zg-Z5s" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="naz-Qh-tGQ"/> <constraint firstItem="ACg-C3-HtA" firstAttribute="leading" secondItem="WO3-AY-H0S" secondAttribute="leading" id="uzK-Ai-LsP"/> + <constraint firstItem="ACg-C3-HtA" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="12" id="yKg-DY-edk"/> </constraints> </tableViewCellContentView> <userDefinedRuntimeAttributes> |