[ios] Fixed edit street controller.

This commit is contained in:
VladiMihaylenko 2016-02-04 18:25:56 +03:00 committed by Sergey Yershov
parent bb17fd36e2
commit 490a0f2c79
5 changed files with 29 additions and 85 deletions

View file

@ -7,11 +7,11 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="YVz-dp-XE1" customClass="MWMEditorSpacerCell">
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="YVz-dp-XE1" customClass="MWMEditorSpacerCell">
<rect key="frame" x="0.0" y="0.0" width="320" height="16"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="YVz-dp-XE1" id="XSE-UM-CqW">
<rect key="frame" x="0.0" y="0.0" width="320" height="15.5"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="15"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="eYv-33-2sa">

View file

@ -7,23 +7,13 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="MWMStreetEditorEditTableViewCell">
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="KGk-i7-Jjw" customClass="MWMStreetEditorEditTableViewCell">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="y71-pl-ZNy" userLabel="Top Separator">
<rect key="frame" x="0.0" y="0.0" width="320" height="1"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="rho-wB-keB"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="blackDividers"/>
</userDefinedRuntimeAttributes>
</view>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="8Pj-WT-J59">
<rect key="frame" x="16" y="12" width="288" height="20"/>
<constraints>
@ -42,28 +32,12 @@
<outlet property="delegate" destination="KGk-i7-Jjw" id="r4r-Wy-T2m"/>
</connections>
</textField>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wEp-rs-Mx2" userLabel="Bottom Separator">
<rect key="frame" x="0.0" y="43" width="320" height="1"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="mWn-4m-iGf"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="blackDividers"/>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="y71-pl-ZNy" secondAttribute="trailing" id="3hm-7B-ISi"/>
<constraint firstItem="wEp-rs-Mx2" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="79I-9v-Y0v"/>
<constraint firstAttribute="trailing" secondItem="wEp-rs-Mx2" secondAttribute="trailing" id="BUg-iQ-jW3"/>
<constraint firstItem="y71-pl-ZNy" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="LFb-op-x1H"/>
<constraint firstAttribute="trailing" secondItem="8Pj-WT-J59" secondAttribute="trailing" constant="16" id="R0z-r6-X9f"/>
<constraint firstAttribute="bottom" secondItem="8Pj-WT-J59" secondAttribute="bottom" constant="12" id="XDU-Xd-7Pl"/>
<constraint firstItem="8Pj-WT-J59" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="fWv-z1-q0b"/>
<constraint firstItem="y71-pl-ZNy" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="iVQ-eK-Qbu"/>
<constraint firstItem="8Pj-WT-J59" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="12" id="wRV-57-6CZ"/>
<constraint firstAttribute="bottom" secondItem="wEp-rs-Mx2" secondAttribute="bottom" id="xaH-zy-7BF"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="white"/>

View file

@ -1,4 +1,4 @@
#import "ViewController.h"
#import "TableViewController.h"
@protocol MWMStreetEditorProtocol <NSObject>
@ -9,7 +9,7 @@
@end
@interface MWMStreetEditorViewController : ViewController
@interface MWMStreetEditorViewController : TableViewController
@property (weak, nonatomic) id<MWMStreetEditorProtocol> delegate;

View file

@ -5,7 +5,6 @@
namespace
{
NSString * const kStreetEditorCommonCell = @"MWMStreetEditorCommonTableViewCell";
NSString * const kStreetEditorSpacerCell = @"MWMEditorSpacerCell";
NSString * const kStreetEditorEditCell = @"MWMStreetEditorEditTableViewCell";
} // namespace
@ -13,8 +12,6 @@ namespace
MWMStreetEditorCommonTableViewCellProtocol,
MWMStreetEditorEditCellProtocol>
@property (weak, nonatomic) IBOutlet UITableView * tableView;
@property (nonatomic) NSMutableArray<NSString *> * streets;
@property (nonatomic) NSUInteger selectedStreet;
@ -70,8 +67,6 @@ namespace
{
[self.tableView registerNib:[UINib nibWithNibName:kStreetEditorCommonCell bundle:nil]
forCellReuseIdentifier:kStreetEditorCommonCell];
[self.tableView registerNib:[UINib nibWithNibName:kStreetEditorSpacerCell bundle:nil]
forCellReuseIdentifier:kStreetEditorSpacerCell];
[self.tableView registerNib:[UINib nibWithNibName:kStreetEditorEditCell bundle:nil]
forCellReuseIdentifier:kStreetEditorEditCell];
}
@ -150,24 +145,25 @@ namespace
NSUInteger const streetsCount = self.streets.count;
if (streetsCount == 0)
return [tableView dequeueReusableCellWithIdentifier:kStreetEditorEditCell];
NSUInteger const index = indexPath.row;
if (index < streetsCount)
if (indexPath.section == 0)
return [tableView dequeueReusableCellWithIdentifier:kStreetEditorCommonCell];
else if (index == streetsCount)
return [tableView dequeueReusableCellWithIdentifier:kStreetEditorSpacerCell];
else
return [tableView dequeueReusableCellWithIdentifier:kStreetEditorEditCell];
}
- (NSInteger)tableView:(UITableView * _Nonnull)tableView numberOfRowsInSection:(NSInteger)section
{
NSUInteger count = self.streets.count;
if (count != 0)
count++; // Spacer cell;
count++;
NSUInteger const count = self.streets.count;
if ((section == 0 && count == 0) || section != 0)
return 1;
return count;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return self.streets.count > 0 ? 2 : 1;
}
#pragma mark - UITableViewDelegate
- (void)tableView:(UITableView * _Nonnull)tableView willDisplayCell:(UITableViewCell * _Nonnull)cell forRowAtIndexPath:(NSIndexPath * _Nonnull)indexPath

View file

@ -770,7 +770,7 @@
<outlet property="tableViewBottomOffset" destination="VXm-ke-yXK" id="Su9-9Z-OP4"/>
<segue destination="IAA-1a-ZuZ" kind="custom" identifier="Editor2CuisineEditorSegue" customClass="MWMSegue" id="mPs-fC-nli"/>
<segue destination="Ld6-gM-2hk" kind="custom" identifier="Editor2OpeningHoursEditorSegue" customClass="MWMSegue" id="iTp-yQ-ied"/>
<segue destination="pFB-aY-HKf" kind="custom" identifier="Editor2StreetEditorSegue" customClass="MWMSegue" id="Q8Z-Ql-2TN"/>
<segue destination="Heu-QR-M0N" kind="custom" identifier="Editor2StreetEditorSegue" customClass="MWMSegue" id="YIe-tB-Qac"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="DWN-06-Lmz" userLabel="First Responder" sceneMemberID="firstResponder"/>
@ -2508,49 +2508,23 @@ the world. Join us!</string>
<point key="canvasLocation" x="-460" y="2753"/>
</scene>
<!--Street Editor View Controller-->
<scene sceneID="6PG-Gv-6DG">
<scene sceneID="hgU-jB-a3C">
<objects>
<viewController id="pFB-aY-HKf" customClass="MWMStreetEditorViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="DQl-ve-BCN"/>
<viewControllerLayoutGuide type="bottom" id="Pfh-op-w6N"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="gEG-Ij-k63">
<tableViewController id="Heu-QR-M0N" customClass="MWMStreetEditorViewController" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="rJJ-UB-6u2">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" allowsSelection="NO" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="go8-4u-rsw">
<rect key="frame" x="0.0" y="20" width="600" height="580"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="rect" keyPath="contentInset">
<rect key="value" x="36" y="0.0" width="0.0" height="0.0"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<outlet property="dataSource" destination="pFB-aY-HKf" id="6rq-wo-2ug"/>
<outlet property="delegate" destination="pFB-aY-HKf" id="bBX-qJ-hcN"/>
</connections>
</tableView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="go8-4u-rsw" firstAttribute="leading" secondItem="gEG-Ij-k63" secondAttribute="leading" id="0vk-iF-rfZ"/>
<constraint firstAttribute="trailing" secondItem="go8-4u-rsw" secondAttribute="trailing" id="8d1-a1-avb"/>
<constraint firstItem="go8-4u-rsw" firstAttribute="top" secondItem="DQl-ve-BCN" secondAttribute="bottom" id="ZJo-gV-j2B"/>
<constraint firstItem="Pfh-op-w6N" firstAttribute="top" secondItem="go8-4u-rsw" secondAttribute="bottom" id="rjT-cD-8AD"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="pressBackground"/>
</userDefinedRuntimeAttributes>
</view>
<connections>
<outlet property="tableView" destination="go8-4u-rsw" id="MeZ-rU-O06"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="FzT-Gq-da5" userLabel="First Responder" sceneMemberID="firstResponder"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<inset key="scrollIndicatorInsets" minX="0.0" minY="44" maxX="0.0" maxY="0.0"/>
<connections>
<outlet property="dataSource" destination="Heu-QR-M0N" id="TzF-Rz-ZsY"/>
<outlet property="delegate" destination="Heu-QR-M0N" id="FI8-IV-zOD"/>
</connections>
</tableView>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dU3-4F-emf" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-460" y="3513"/>
<point key="canvasLocation" x="-442" y="3513"/>
</scene>
</scenes>
<resources>