forked from organicmaps/organicmaps
[ios] Fixed search in objects category controller.
This commit is contained in:
parent
b7ec276112
commit
5282882c06
3 changed files with 96 additions and 30 deletions
|
@ -1,4 +1,4 @@
|
|||
#import "MWMTableViewController.h"
|
||||
#import "MWMViewController.h"
|
||||
|
||||
#include "indexer/editable_map_object.hpp"
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
|||
|
||||
@end
|
||||
|
||||
@interface MWMObjectsCategorySelectorController : MWMTableViewController
|
||||
@interface MWMObjectsCategorySelectorController : MWMViewController
|
||||
|
||||
@property (weak, nonatomic) id<MWMObjectsCategorySelectorDelegate> delegate;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#import "MWMEditorViewController.h"
|
||||
#import "MWMObjectsCategorySelectorController.h"
|
||||
#import "MWMTableViewCell.h"
|
||||
#import "UIColor+MapsMeColor.h"
|
||||
#import "UIViewController+Navigation.h"
|
||||
|
||||
|
@ -14,12 +15,13 @@ namespace
|
|||
NSString * const kToEditorSegue = @"CategorySelectorToEditorSegue";
|
||||
} // namespace
|
||||
|
||||
@interface MWMObjectsCategorySelectorController () <UISearchBarDelegate>
|
||||
@interface MWMObjectsCategorySelectorController () <UISearchBarDelegate, UITableViewDelegate, UITableViewDataSource>
|
||||
{
|
||||
NewFeatureCategories m_categories;
|
||||
vector<Category> m_filteredCategories;
|
||||
}
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UITableView * tableView;
|
||||
@property (weak, nonatomic) IBOutlet UISearchBar * searchBar;
|
||||
@property (nonatomic) NSIndexPath * selectedIndexPath;
|
||||
@property (nonatomic) BOOL isSearch;
|
||||
|
@ -37,10 +39,18 @@ namespace
|
|||
NSAssert(!m_categories.m_allSorted.empty(), @"Categories list can't be empty!");
|
||||
|
||||
self.isSearch = NO;
|
||||
[self configTable];
|
||||
[self configNavBar];
|
||||
[self configSearchBar];
|
||||
}
|
||||
|
||||
- (void)configTable
|
||||
{
|
||||
self.tableView.backgroundColor = [UIColor pressBackground];
|
||||
self.tableView.separatorColor = [UIColor blackDividers];
|
||||
[self.tableView registerClass:[MWMTableViewCell class] forCellReuseIdentifier:[UITableViewCell className]];
|
||||
}
|
||||
|
||||
- (void)setSelectedCategory:(string const &)category
|
||||
{
|
||||
m_categories = GetFramework().GetEditorCategories();
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
<segue destination="F1F-MH-A36" kind="custom" identifier="Map2MigrationSegue" customClass="MWMSegue" id="iqY-sY-TLu"/>
|
||||
<segue destination="2fX-ws-Tuc" kind="custom" identifier="Map2AuthorizationSegue" customClass="MWMSegue" id="CJ1-sY-Il4"/>
|
||||
<segue destination="Lfa-Zp-orR" kind="custom" identifier="Map2EditorSegue" customClass="MWMSegue" id="OEF-kR-jKi"/>
|
||||
<segue destination="sAj-hs-LjL" kind="custom" identifier="MapToCategorySelectorSegue" customClass="MWMSegue" id="yAJ-jH-Dus"/>
|
||||
<segue destination="Lgr-ZK-lGB" kind="custom" identifier="Map2ReportSegue" customClass="MWMSegue" id="gCh-Ix-flI"/>
|
||||
<segue destination="QlF-CJ-cEG" kind="custom" identifier="MapToCategorySelectorSegue" customClass="MWMSegue" id="4Cc-99-mlN"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="cKg-Q7-bFd" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
|
@ -1235,7 +1235,7 @@
|
|||
<segue destination="Ld6-gM-2hk" kind="custom" identifier="Editor2OpeningHoursEditorSegue" customClass="MWMSegue" id="EMH-RE-PDh"/>
|
||||
<segue destination="Heu-QR-M0N" kind="custom" identifier="Editor2StreetEditorSegue" customClass="MWMSegue" id="iJS-b1-GuT"/>
|
||||
<segue destination="xZs-iI-22O" kind="custom" identifier="Editor2CuisineEditorSegue" customClass="MWMSegue" id="qEA-7d-gOo"/>
|
||||
<segue destination="sAj-hs-LjL" kind="custom" identifier="Editor2CategoryEditorSegue" customClass="MWMSegue" id="8Pk-Zz-Tks"/>
|
||||
<segue destination="QlF-CJ-cEG" kind="custom" identifier="Editor2CategoryEditorSegue" customClass="MWMSegue" id="urr-1u-jhn"/>
|
||||
</connections>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="FGq-OI-eQl" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
|
@ -2779,34 +2779,90 @@ the world. Join us!</string>
|
|||
<point key="canvasLocation" x="154" y="3513"/>
|
||||
</scene>
|
||||
<!--Objects Category Selector Controller-->
|
||||
<scene sceneID="NTU-yk-R2R">
|
||||
<scene sceneID="hWY-Fu-EcX">
|
||||
<objects>
|
||||
<tableViewController storyboardIdentifier="MWMObjectsCategorySelectorController" id="sAj-hs-LjL" customClass="MWMObjectsCategorySelectorController" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" keyboardDismissMode="onDrag" dataMode="prototypes" style="grouped" separatorStyle="default" showsSelectionImmediatelyOnTouchBegin="NO" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="GCv-Mg-Pte">
|
||||
<viewController id="QlF-CJ-cEG" customClass="MWMObjectsCategorySelectorController" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="eAi-nD-Wok"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="Ugs-ZC-gWI"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="MIY-NW-Joh">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<searchBar key="tableHeaderView" contentMode="redraw" id="9aq-NE-D4v">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="sAj-hs-LjL" id="ScZ-zQ-SLD"/>
|
||||
</connections>
|
||||
</searchBar>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="sAj-hs-LjL" id="Odk-6u-Adu"/>
|
||||
<outlet property="delegate" destination="sAj-hs-LjL" id="9wJ-mw-w1X"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<subviews>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" keyboardDismissMode="onDrag" dataMode="prototypes" style="grouped" separatorStyle="default" showsSelectionImmediatelyOnTouchBegin="NO" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="JbV-y9-HBo">
|
||||
<rect key="frame" x="0.0" y="64" width="600" height="536"/>
|
||||
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="pressBackground"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="QlF-CJ-cEG" id="vD2-pf-Vhj"/>
|
||||
<outlet property="delegate" destination="QlF-CJ-cEG" id="QFe-QZ-zDw"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="rI9-RR-sKP" userLabel="Status Bar Background">
|
||||
<rect key="frame" x="0.0" y="-44" width="600" height="108"/>
|
||||
<color key="backgroundColor" red="0.1215686275" green="0.59999999999999998" blue="0.32156862749999998" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="tintColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="108" id="Qw2-w6-Efn"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="primary"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.shadowRadius">
|
||||
<integer key="value" value="2"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="layer.shadowUIColor">
|
||||
<color key="value" red="0.0" green="0.0" blue="0.0" alpha="0.23999999999999999" colorSpace="calibratedRGB"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.shadowOpacity">
|
||||
<integer key="value" value="1"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="size" keyPath="layer.shadowOffset">
|
||||
<size key="value" width="0.0" height="0.0"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<searchBar contentMode="redraw" translatesAutoresizingMaskIntoConstraints="NO" id="gzF-B7-8pj">
|
||||
<rect key="frame" x="0.0" y="20" width="600" height="44"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="44" id="2uI-k6-ahr"/>
|
||||
</constraints>
|
||||
<color key="barTintColor" red="0.1215686275" green="0.59999999999999998" blue="0.32156862749999998" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="QlF-CJ-cEG" id="E9l-Dh-dkk"/>
|
||||
</connections>
|
||||
</searchBar>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="gzF-B7-8pj" secondAttribute="trailing" id="05P-0L-iQz"/>
|
||||
<constraint firstItem="rI9-RR-sKP" firstAttribute="leading" secondItem="gzF-B7-8pj" secondAttribute="leading" id="5UI-FH-LNP"/>
|
||||
<constraint firstAttribute="trailing" secondItem="JbV-y9-HBo" secondAttribute="trailing" id="9Eh-BE-WvD"/>
|
||||
<constraint firstItem="rI9-RR-sKP" firstAttribute="bottom" secondItem="gzF-B7-8pj" secondAttribute="bottom" id="Cct-ww-qJd"/>
|
||||
<constraint firstItem="Ugs-ZC-gWI" firstAttribute="top" secondItem="JbV-y9-HBo" secondAttribute="bottom" id="JxK-xu-ZHw"/>
|
||||
<constraint firstItem="JbV-y9-HBo" firstAttribute="leading" secondItem="MIY-NW-Joh" secondAttribute="leading" id="MFw-S4-taL"/>
|
||||
<constraint firstItem="JbV-y9-HBo" firstAttribute="top" secondItem="rI9-RR-sKP" secondAttribute="bottom" id="X6Z-Ta-uoQ"/>
|
||||
<constraint firstItem="gzF-B7-8pj" firstAttribute="top" secondItem="eAi-nD-Wok" secondAttribute="bottom" id="YYe-8d-Lnc"/>
|
||||
<constraint firstItem="rI9-RR-sKP" firstAttribute="trailing" secondItem="gzF-B7-8pj" secondAttribute="trailing" id="cbi-zj-ge8"/>
|
||||
<constraint firstItem="gzF-B7-8pj" firstAttribute="leading" secondItem="MIY-NW-Joh" secondAttribute="leading" id="gQZ-gg-Opf"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="pressBackground"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="searchBar" destination="9aq-NE-D4v" id="iBm-Wj-fZm"/>
|
||||
<segue destination="Lfa-Zp-orR" kind="custom" identifier="CategorySelectorToEditorSegue" customClass="MWMSegue" id="fuS-6s-TH4"/>
|
||||
<outlet property="searchBar" destination="gzF-B7-8pj" id="X59-8C-1yC"/>
|
||||
<outlet property="tableView" destination="JbV-y9-HBo" id="uQw-El-Xes"/>
|
||||
<segue destination="Lfa-Zp-orR" kind="custom" identifier="CategorySelectorToEditorSegue" customClass="MWMSegue" id="gFM-Ca-ARt"/>
|
||||
</connections>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="0oU-uS-X5H" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iSu-YM-7aH" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-366" y="2753"/>
|
||||
<point key="canvasLocation" x="-372" y="2753"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
|
@ -2822,9 +2878,9 @@ the world. Join us!</string>
|
|||
<image name="separator_image" width="1" height="1"/>
|
||||
</resources>
|
||||
<inferredMetricsTieBreakers>
|
||||
<segue reference="mF7-g4-gSS"/>
|
||||
<segue reference="yAJ-jH-Dus"/>
|
||||
<segue reference="Pet-Wq-d4a"/>
|
||||
<segue reference="fuS-6s-TH4"/>
|
||||
<segue reference="Z0Z-aU-Vrq"/>
|
||||
<segue reference="gFM-Ca-ARt"/>
|
||||
<segue reference="urr-1u-jhn"/>
|
||||
</inferredMetricsTieBreakers>
|
||||
</document>
|
||||
|
|
Loading…
Add table
Reference in a new issue