forked from organicmaps/organicmaps
[ios] Updated editor layout.
This commit is contained in:
parent
96eace9262
commit
79c126be0d
6 changed files with 37 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15A284" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
|
||||
|
@ -143,6 +143,7 @@
|
|||
<constraint firstItem="7Oa-hg-icC" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="hpw-oR-ZSb" secondAttribute="trailing" priority="310" constant="12" id="efF-u9-Cqb"/>
|
||||
<constraint firstAttribute="trailing" secondItem="ZdV-4y-cz4" secondAttribute="trailing" constant="32" id="hnz-zM-TYH"/>
|
||||
<constraint firstAttribute="height" constant="126" id="hsa-4B-Df0"/>
|
||||
<constraint firstItem="mGc-k4-uvQ" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="oTF-IZ-Un1" secondAttribute="trailing" priority="750" constant="8" id="iiH-Tm-ybN"/>
|
||||
<constraint firstItem="Ot5-QJ-jhp" firstAttribute="top" secondItem="swk-um-XzG" secondAttribute="top" constant="12" id="n1a-Y2-Nfo"/>
|
||||
<constraint firstAttribute="bottom" secondItem="EcD-Q8-7zu" secondAttribute="bottom" constant="12" id="qwA-KB-e9x"/>
|
||||
<constraint firstItem="7Oa-hg-icC" firstAttribute="width" secondItem="oTF-IZ-Un1" secondAttribute="width" id="txT-Kq-5WC"/>
|
||||
|
@ -226,7 +227,7 @@
|
|||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="ic_arrow_gray_down" width="14" height="8"/>
|
||||
<image name="ic_arrow_gray_down" width="28" height="28"/>
|
||||
<image name="ic_placepage_open_hours" width="28" height="28"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
@protocol MWMEditorCellProtocol <NSObject>
|
||||
|
||||
- (void)cellBeginEditing:(UITableViewCell *)cell;
|
||||
- (void)cell:(UITableViewCell *)cell changeText:(NSString *)changeText;
|
||||
- (void)cell:(UITableViewCell *)cell changeSwitch:(BOOL)changeSwitch;
|
||||
- (void)cellSelect:(UITableViewCell *)cell;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15A284" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
|
||||
|
@ -42,7 +42,7 @@
|
|||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="XnK-GX-uDn">
|
||||
<rect key="frame" x="80" y="0.0" width="232" height="44"/>
|
||||
<rect key="frame" x="88" y="0.0" width="224" height="44"/>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="17"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
|
@ -75,7 +75,7 @@
|
|||
<constraint firstItem="yj2-am-tAr" firstAttribute="leading" secondItem="mvz-Ot-27A" secondAttribute="leading" id="JRR-dE-cYG"/>
|
||||
<constraint firstItem="jB4-CQ-ibl" firstAttribute="leading" secondItem="mvz-Ot-27A" secondAttribute="leading" id="Jfv-Vz-USn"/>
|
||||
<constraint firstItem="XnK-GX-uDn" firstAttribute="top" secondItem="mvz-Ot-27A" secondAttribute="top" id="PhE-q8-q9Q"/>
|
||||
<constraint firstItem="XnK-GX-uDn" firstAttribute="leading" secondItem="xKX-yy-Dlc" secondAttribute="trailing" constant="4" id="PlX-hV-AJE"/>
|
||||
<constraint firstItem="XnK-GX-uDn" firstAttribute="leading" secondItem="xKX-yy-Dlc" secondAttribute="trailing" constant="12" id="PlX-hV-AJE"/>
|
||||
<constraint firstItem="xKX-yy-Dlc" firstAttribute="leading" secondItem="mvz-Ot-27A" secondAttribute="leading" constant="16" id="QdJ-7J-og8"/>
|
||||
<constraint firstItem="xKX-yy-Dlc" firstAttribute="centerY" secondItem="mvz-Ot-27A" secondAttribute="centerY" id="Ss3-Uz-Ovp"/>
|
||||
<constraint firstAttribute="height" constant="44" id="XaU-he-xkw"/>
|
||||
|
|
|
@ -36,11 +36,18 @@
|
|||
|
||||
#pragma mark - UITextFieldDelegate
|
||||
|
||||
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
|
||||
{
|
||||
[self.delegate cellBeginEditing:self];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)textField:(UITextField *)textField
|
||||
shouldChangeCharactersInRange:(NSRange)range
|
||||
replacementString:(NSString *)string
|
||||
{
|
||||
NSString * newString = [textField.text stringByReplacingCharactersInRange:range withString:string];
|
||||
NSString * newString =
|
||||
[textField.text stringByReplacingCharactersInRange:range withString:string];
|
||||
BOOL const isCorrect = [textField.validator validateString:newString];
|
||||
if (isCorrect)
|
||||
[self.delegate cell:self changeText:newString];
|
||||
|
|
|
@ -73,6 +73,7 @@ NSString * reuseIdentifier(MWMPlacePageCellType cellType)
|
|||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint * tableViewBottomOffset;
|
||||
|
||||
@property (nonatomic) NSMutableDictionary<NSString *, UITableViewCell *> * offscreenCells;
|
||||
@property (weak, nonatomic) UITableViewCell * editCell;
|
||||
|
||||
@property (nonatomic) BOOL needsReload;
|
||||
|
||||
|
@ -130,14 +131,25 @@ NSString * reuseIdentifier(MWMPlacePageCellType cellType)
|
|||
NSDictionary * info = [aNotification userInfo];
|
||||
CGFloat const kbYEnd = [info[UIKeyboardFrameEndUserInfoKey] CGRectValue].origin.y;
|
||||
CGFloat const kbYBeg = [info[UIKeyboardFrameBeginUserInfoKey] CGRectValue].origin.y;
|
||||
UIViewAnimationCurve const curve = static_cast<UIViewAnimationCurve>([info[UIKeyboardAnimationCurveUserInfoKey] integerValue]);
|
||||
UIViewAnimationCurve const curve =
|
||||
static_cast<UIViewAnimationCurve>([info[UIKeyboardAnimationCurveUserInfoKey] integerValue]);
|
||||
NSTimeInterval const duration = [info[UIKeyboardAnimationDurationUserInfoKey] doubleValue];
|
||||
[self.view layoutIfNeeded];
|
||||
self.tableViewBottomOffset.constant = kbYEnd < kbYBeg ? kbYBeg - kbYEnd : 0.0;
|
||||
UITableView * tv = self.tableView;
|
||||
NSIndexPath * cellPath = [tv indexPathForCell:self.editCell];
|
||||
[tv scrollToRowAtIndexPath:cellPath atScrollPosition:UITableViewScrollPositionNone animated:YES];
|
||||
if (kbYEnd < kbYBeg)
|
||||
self.tableViewBottomOffset.constant = kbYBeg - kbYEnd;
|
||||
else if (kbYEnd > kbYBeg)
|
||||
self.tableViewBottomOffset.constant = 0.0;
|
||||
[UIView animateWithDuration:duration delay:0.0 options:curve animations:^
|
||||
{
|
||||
[self.view layoutIfNeeded];
|
||||
} completion:nil];
|
||||
}
|
||||
completion:^(BOOL finished)
|
||||
{
|
||||
[tv scrollToRowAtIndexPath:cellPath atScrollPosition:UITableViewScrollPositionNone animated:YES];
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
@ -477,6 +489,11 @@ NSString * reuseIdentifier(MWMPlacePageCellType cellType)
|
|||
|
||||
#pragma mark - MWMEditorCellProtocol
|
||||
|
||||
- (void)cellBeginEditing:(UITableViewCell *)cell
|
||||
{
|
||||
self.editCell = cell;
|
||||
}
|
||||
|
||||
- (void)cell:(UITableViewCell *)cell changeText:(NSString *)changeText
|
||||
{
|
||||
NSIndexPath * indexPath = [self.tableView indexPathForCell:cell];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15A284" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
|
||||
|
@ -17,7 +17,7 @@
|
|||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="jmU-dJ-aRH">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" priority="750" constant="44" id="gfO-mi-8yS"/>
|
||||
<constraint firstAttribute="height" priority="999" constant="44" id="gfO-mi-8yS"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="17"/>
|
||||
<inset key="contentEdgeInsets" minX="16" minY="0.0" maxX="9" maxY="0.0"/>
|
||||
|
|
Loading…
Add table
Reference in a new issue