Repo created

This commit is contained in:
Fr4nz D13trich 2025-11-22 13:58:55 +01:00
parent 4af19165ec
commit 68073add76
12458 changed files with 12350765 additions and 2 deletions

View file

@ -0,0 +1,3 @@
@objc(MWMEditorAdditionalNamePlaceholderTableViewCell)
final class EditorAdditionalNamePlaceholderTableViewCell: MWMTableViewCell {
}

View file

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="16" id="7Br-fC-W0o" customClass="MWMEditorAdditionalNamePlaceholderTableViewCell" propertyAccessControl="none">
<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="7Br-fC-W0o" id="58c-Uv-d0K">
<rect key="frame" x="0.0" y="0.0" width="320" height="16"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="tYH-si-HMY">
<rect key="frame" x="0.0" y="0.0" width="320" height="16"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" priority="750" constant="16" id="A96-CL-Yji"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="tYH-si-HMY" firstAttribute="leading" secondItem="58c-Uv-d0K" secondAttribute="leading" id="GTY-XA-kVU"/>
<constraint firstAttribute="trailing" secondItem="tYH-si-HMY" secondAttribute="trailing" id="VOL-Tl-l3w"/>
<constraint firstAttribute="bottom" secondItem="tYH-si-HMY" secondAttribute="bottom" id="g0D-w9-dGP"/>
<constraint firstItem="tYH-si-HMY" firstAttribute="top" secondItem="58c-Uv-d0K" secondAttribute="top" id="qyd-oG-Ixi"/>
</constraints>
</tableViewCellContentView>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
</userDefinedRuntimeAttributes>
<point key="canvasLocation" x="225" y="282"/>
</tableViewCell>
</objects>
</document>

View file

@ -0,0 +1,17 @@
#import "MWMTableViewCell.h"
NS_ASSUME_NONNULL_BEGIN
@protocol MWMButtonCellDelegate <NSObject>
- (void)cellDidPressButton:(UITableViewCell *)cell;
@end
@interface MWMButtonCell : MWMTableViewCell
- (void)configureWithDelegate:(id<MWMButtonCellDelegate>)delegate title:(NSString *)title enabled:(BOOL)enabled;
@end
NS_ASSUME_NONNULL_END

View file

@ -0,0 +1,22 @@
#import "MWMButtonCell.h"
@interface MWMButtonCell ()
@property(nonatomic) IBOutlet UIButton *button;
@property(weak, nonatomic) id<MWMButtonCellDelegate> delegate;
@end
@implementation MWMButtonCell
- (void)configureWithDelegate:(id<MWMButtonCellDelegate>)delegate title:(NSString *)title enabled:(BOOL)enabled {
[self.button setTitle:title forState:UIControlStateNormal];
self.button.enabled = enabled;
self.delegate = delegate;
}
- (IBAction)buttonTap {
[self.delegate cellDidPressButton:self];
}
@end

View file

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="KGk-i7-Jjw" customClass="MWMButtonCell" propertyAccessControl="none">
<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="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="c7Y-Nr-P4C">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="44" id="Z6u-ES-sTJ"/>
</constraints>
<state key="normal" title="Button">
<color key="titleColor" red="0.95686274510000002" green="0.26274509800000001" blue="0.21176470589999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="BookmarksCategoryDeleteButton"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="buttonTap" destination="KGk-i7-Jjw" eventType="touchUpInside" id="kS2-aj-wfq"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="c7Y-Nr-P4C" secondAttribute="trailing" id="AVP-GR-W7u"/>
<constraint firstAttribute="bottom" secondItem="c7Y-Nr-P4C" secondAttribute="bottom" id="F3N-Zb-tnQ"/>
<constraint firstItem="c7Y-Nr-P4C" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="JQx-63-Ane"/>
<constraint firstItem="c7Y-Nr-P4C" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="fTj-1o-vWJ"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="button" destination="c7Y-Nr-P4C" id="UDx-n5-6fr"/>
</connections>
<point key="canvasLocation" x="139" y="155"/>
</tableViewCell>
</objects>
</document>

View file

@ -0,0 +1,8 @@
#import "MWMEditorCommon.h"
#import "MWMTableViewCell.h"
@interface MWMEditorAddAdditionalNameTableViewCell : MWMTableViewCell
- (void)configWithDelegate:(id<MWMEditorAdditionalName>)delegate;
@end

View file

@ -0,0 +1,13 @@
#import "MWMEditorAddAdditionalNameTableViewCell.h"
@interface MWMEditorAddAdditionalNameTableViewCell ()
@property(weak, nonatomic) id<MWMEditorAdditionalName> delegate;
@end
@implementation MWMEditorAddAdditionalNameTableViewCell
- (void)configWithDelegate:(id<MWMEditorAdditionalName>)delegate { self.delegate = delegate; }
- (IBAction)addLanguageTap { [self.delegate editAdditionalNameLanguage:NSNotFound]; }
@end

View file

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23727" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23721"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="81H-Jz-Sl2" customClass="MWMEditorAddAdditionalNameTableViewCell" propertyAccessControl="none">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="81H-Jz-Sl2" id="EHS-hP-aIE">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Ua5-4V-1PH" customClass="MWMButton">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<constraints>
<constraint firstAttribute="height" priority="750" constant="44" id="oVm-ep-LLL"/>
</constraints>
<inset key="contentEdgeInsets" minX="12" minY="0.0" maxX="0.0" maxY="0.0"/>
<inset key="titleEdgeInsets" minX="14" minY="0.0" maxX="0.0" maxY="0.0"/>
<state key="normal" title="add_language" image="plus.circle.fill" catalog="system"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="FlatNormalTransButtonBig"/>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="add_language"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="addLanguageTap" destination="81H-Jz-Sl2" eventType="touchUpInside" id="Lw7-kU-hIK"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="Ua5-4V-1PH" secondAttribute="bottom" id="Nmp-Cj-ffg"/>
<constraint firstItem="Ua5-4V-1PH" firstAttribute="leading" secondItem="EHS-hP-aIE" secondAttribute="leading" id="XP5-8s-Vka"/>
<constraint firstItem="Ua5-4V-1PH" firstAttribute="top" secondItem="EHS-hP-aIE" secondAttribute="top" id="YAU-Xb-h9Y"/>
<constraint firstAttribute="trailing" secondItem="Ua5-4V-1PH" secondAttribute="trailing" id="f6J-6o-AjX"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
</userDefinedRuntimeAttributes>
</tableViewCellContentView>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
</userDefinedRuntimeAttributes>
<point key="canvasLocation" x="342" y="257"/>
</tableViewCell>
</objects>
<resources>
<image name="plus.circle.fill" catalog="system" width="128" height="123"/>
</resources>
</document>

View file

@ -0,0 +1,16 @@
#import "MWMEditorCommon.h"
#import "MWMTableViewCell.h"
@interface MWMEditorAdditionalNameTableViewCell : MWMTableViewCell
@property(nonatomic, readonly) NSInteger code;
- (void)configWithDelegate:(id<MWMEditorAdditionalName>)delegate
langCode:(NSInteger)langCode
langName:(NSString *)langName
name:(NSString *)name
errorMessage:(NSString *)errorMessage
isValid:(BOOL)isValid
keyboardType:(UIKeyboardType)keyboardType;
@end

View file

@ -0,0 +1,103 @@
#import "MWMEditorAdditionalNameTableViewCell.h"
#import "SwiftBridge.h"
static CGFloat const kErrorLabelHeight = 16;
@interface MWMEditorAdditionalNameTableViewCell ()
@property(weak, nonatomic) IBOutlet UIStackView * stackView;
@property(weak, nonatomic) IBOutlet UILabel * languageLabel;
@property(weak, nonatomic) IBOutlet UITextField * textField;
@property(weak, nonatomic) IBOutlet UILabel * errorLabel;
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * errorLabelHeight;
@property(nonatomic, readwrite) NSInteger code;
@property(weak, nonatomic) id<MWMEditorAdditionalName> delegate;
@property(nonatomic) BOOL isValid;
@end
@implementation MWMEditorAdditionalNameTableViewCell
- (void)configWithDelegate:(id<MWMEditorAdditionalName>)delegate
langCode:(NSInteger)langCode
langName:(NSString *)langName
name:(NSString *)name
errorMessage:(NSString *)errorMessage
isValid:(BOOL)isValid
keyboardType:(UIKeyboardType)keyboardType
{
self.delegate = delegate;
self.code = langCode;
self.languageLabel.text = langName;
self.errorLabel.text = errorMessage;
self.isValid = isValid;
self.textField.text = name;
self.textField.keyboardType = keyboardType;
self.textField.backgroundColor = [UIColor clearColor];
[self processValidation];
}
- (void)processValidation
{
if (self.isValid)
{
self.errorLabelHeight.constant = 0;
[self.contentView setStyleNameAndApply: @"Background"];
}
else
{
self.errorLabelHeight.constant = kErrorLabelHeight;
[self.contentView setStyleNameAndApply: @"ErrorBackground"];
}
[self layoutIfNeeded];
}
- (void)changeInvalidCellState
{
if (self.isValid)
return;
self.isValid = YES;
[self processValidation];
[self.delegate tryToChangeInvalidStateForCell:self];
}
#pragma mark - UITextFieldDelegate
- (BOOL)textField:(UITextField *)textField
shouldChangeCharactersInRange:(NSRange)range
replacementString:(NSString *)string
{
[self changeInvalidCellState];
return YES;
}
- (BOOL)textFieldShouldClear:(UITextField *)textField
{
[self changeInvalidCellState];
return YES;
}
- (void)textFieldDidEndEditing:(UITextField *)textField
{
[self.delegate cell:self changedText:textField.text];
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField resignFirstResponder];
return YES;
}
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
// Allow to tap on the whole cell to start editing.
UIView * view = [super hitTest:point withEvent:event];
if (view == self.stackView)
return self.textField;
return view;
}
@end

View file

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="hfo-cP-AGX" customClass="MWMEditorAdditionalNameTableViewCell">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="hfo-cP-AGX" id="JQH-ks-NoC">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillProportionally" alignment="top" spacing="3" translatesAutoresizingMaskIntoConstraints="NO" id="eca-XW-QZR">
<rect key="frame" x="16" y="16" width="288" height="12"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="zh-classical" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="efb-nS-cjm">
<rect key="frame" x="0.0" y="0.0" width="77" height="5"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackSecondaryText"/>
</userDefinedRuntimeAttributes>
</label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" horizontalCompressionResistancePriority="499" contentHorizontalAlignment="left" contentVerticalAlignment="center" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="9BY-PA-dlA">
<rect key="frame" x="0.0" y="8" width="5" height="4"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<textInputTraits key="textInputTraits"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17:blackPrimaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="localizedPlaceholder" value="editor_edit_place_name_hint"/>
</userDefinedRuntimeAttributes>
<connections>
<outlet property="delegate" destination="hfo-cP-AGX" id="jkD-0x-Ods"/>
</connections>
</textField>
</subviews>
<constraints>
<constraint firstItem="9BY-PA-dlA" firstAttribute="width" secondItem="eca-XW-QZR" secondAttribute="width" id="OSr-03-hPe"/>
</constraints>
</stackView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="252" translatesAutoresizingMaskIntoConstraints="NO" id="SZa-Bj-se1">
<rect key="frame" x="60" y="32" width="252" height="0.0"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" priority="999" id="CPF-uE-pzx"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.95686274510000002" green="0.26274509800000001" blue="0.21176470589999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular12:redText"/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<constraints>
<constraint firstItem="SZa-Bj-se1" firstAttribute="leading" secondItem="JQH-ks-NoC" secondAttribute="leading" constant="60" id="BcS-gb-9vl"/>
<constraint firstAttribute="trailing" secondItem="SZa-Bj-se1" secondAttribute="trailing" constant="8" id="EBU-G3-tgp"/>
<constraint firstItem="eca-XW-QZR" firstAttribute="top" secondItem="JQH-ks-NoC" secondAttribute="top" constant="16" id="FJ5-Zj-wLR"/>
<constraint firstAttribute="trailing" secondItem="eca-XW-QZR" secondAttribute="trailing" constant="16" id="NZO-C9-ZCS"/>
<constraint firstItem="SZa-Bj-se1" firstAttribute="top" secondItem="eca-XW-QZR" secondAttribute="bottom" constant="4" id="T9Z-G5-LVc"/>
<constraint firstAttribute="bottom" secondItem="SZa-Bj-se1" secondAttribute="bottom" constant="12" id="TdX-jx-CpD"/>
<constraint firstItem="eca-XW-QZR" firstAttribute="leading" secondItem="JQH-ks-NoC" secondAttribute="leading" constant="16" id="dbb-bG-8uT"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
</userDefinedRuntimeAttributes>
</tableViewCellContentView>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
</userDefinedRuntimeAttributes>
<connections>
<outlet property="errorLabel" destination="SZa-Bj-se1" id="hqN-vX-0Hw"/>
<outlet property="errorLabelHeight" destination="CPF-uE-pzx" id="X4g-6X-W0e"/>
<outlet property="languageLabel" destination="efb-nS-cjm" id="13M-9D-Qbf"/>
<outlet property="stackView" destination="eca-XW-QZR" id="RPt-fc-aoR"/>
<outlet property="textField" destination="9BY-PA-dlA" id="SCv-JL-5TL"/>
</connections>
<point key="canvasLocation" x="340.57971014492756" y="256.47321428571428"/>
</tableViewCell>
</objects>
</document>

View file

@ -0,0 +1,11 @@
#import "MWMTableViewCell.h"
@protocol MWMEditorCellProtocol;
@interface MWMEditorCategoryCell : MWMTableViewCell
- (void)configureWithDelegate:(id<MWMEditorCellProtocol>)delegate
detailTitle:(NSString *)detail
isCreating:(BOOL)isCreating;
@end

View file

@ -0,0 +1,44 @@
#import "MWMEditorCategoryCell.h"
#import "MWMEditorCommon.h"
#import "SwiftBridge.h"
CGFloat const kDetailShortRightSpace = 16;
@interface MWMEditorCategoryCell ()
@property(weak, nonatomic) IBOutlet UIImageView * accessoryIcon;
@property(weak, nonatomic) IBOutlet UILabel * detail;
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * detailRightSpace;
@property(weak, nonatomic) id<MWMEditorCellProtocol> delegate;
@end
@implementation MWMEditorCategoryCell
- (void)configureWithDelegate:(id<MWMEditorCellProtocol>)delegate
detailTitle:(NSString *)detail
isCreating:(BOOL)isCreating
{
self.delegate = delegate;
self.detail.text = detail;
self.accessoryIcon.hidden = !isCreating;
if (isCreating)
{
self.selectedBackgroundView = [[UIView alloc] init];
self.selectedBackgroundView.styleName = @"PressBackground";
}
else
{
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.detailRightSpace.constant = kDetailShortRightSpace;
}
}
- (IBAction)cellTap
{
if (self.accessoryIcon.hidden)
return;
[self.delegate cellDidPressButton:self];
}
@end

View file

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<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="rsc-tP-qGq" customClass="MWMEditorCategoryCell" propertyAccessControl="none">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="rsc-tP-qGq" id="mWc-I7-4kZ">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_arrow_gray_right" translatesAutoresizingMaskIntoConstraints="NO" id="uA3-ru-Ja1">
<rect key="frame" x="286" y="8" width="28" height="28"/>
<constraints>
<constraint firstAttribute="width" constant="28" id="CW0-pF-saL"/>
<constraint firstAttribute="height" constant="28" id="P6z-Sg-ZyD"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMGray"/>
</userDefinedRuntimeAttributes>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Jfx-Kc-WOc">
<rect key="frame" x="16" y="12" width="226" height="20"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="50" id="BaE-rI-CN2"/>
<constraint firstAttribute="height" constant="20" id="oLW-um-5dA"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17:blackPrimaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="editor_edit_place_category_title"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="501" verticalHuggingPriority="251" text="Label" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qrd-hP-nIJ">
<rect key="frame" x="250" y="11.5" width="42" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="hsO-dV-WsY"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17:blackSecondaryText"/>
</userDefinedRuntimeAttributes>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="icU-WX-U52">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<connections>
<action selector="cellTap" destination="rsc-tP-qGq" eventType="touchUpInside" id="dru-SF-L7z"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="Jfx-Kc-WOc" firstAttribute="leading" secondItem="mWc-I7-4kZ" secondAttribute="leading" constant="16" id="5lg-6C-NQt"/>
<constraint firstItem="qrd-hP-nIJ" firstAttribute="leading" secondItem="Jfx-Kc-WOc" secondAttribute="trailing" constant="8" id="ETn-mX-ysj"/>
<constraint firstItem="Jfx-Kc-WOc" firstAttribute="centerY" secondItem="mWc-I7-4kZ" secondAttribute="centerY" id="P6u-UL-5f7"/>
<constraint firstAttribute="trailing" secondItem="qrd-hP-nIJ" secondAttribute="trailing" constant="28" id="Rwj-G9-EoG"/>
<constraint firstAttribute="trailing" secondItem="uA3-ru-Ja1" secondAttribute="trailing" constant="6" id="byM-mn-aQu"/>
<constraint firstItem="uA3-ru-Ja1" firstAttribute="centerY" secondItem="mWc-I7-4kZ" secondAttribute="centerY" id="sVc-Kt-8ZX"/>
<constraint firstItem="qrd-hP-nIJ" firstAttribute="centerY" secondItem="mWc-I7-4kZ" secondAttribute="centerY" id="wSH-Lz-TEL"/>
</constraints>
</tableViewCellContentView>
<constraints>
<constraint firstItem="icU-WX-U52" firstAttribute="centerX" secondItem="rsc-tP-qGq" secondAttribute="centerX" id="F9k-Ej-LFc"/>
<constraint firstItem="icU-WX-U52" firstAttribute="width" secondItem="rsc-tP-qGq" secondAttribute="width" id="ZUi-Rh-jlL"/>
<constraint firstItem="icU-WX-U52" firstAttribute="height" secondItem="rsc-tP-qGq" secondAttribute="height" id="dy8-tF-aiq"/>
<constraint firstItem="icU-WX-U52" firstAttribute="centerY" secondItem="rsc-tP-qGq" secondAttribute="centerY" id="uky-CX-2ye"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
</userDefinedRuntimeAttributes>
<connections>
<outlet property="accessoryIcon" destination="uA3-ru-Ja1" id="esf-Xi-gLG"/>
<outlet property="detail" destination="qrd-hP-nIJ" id="IOE-vz-HaI"/>
<outlet property="detailRightSpace" destination="Rwj-G9-EoG" id="H8f-mf-vOJ"/>
</connections>
<point key="canvasLocation" x="501.44927536231887" y="199.55357142857142"/>
</tableViewCell>
</objects>
<resources>
<image name="ic_arrow_gray_right" width="28" height="28"/>
</resources>
</document>

View file

@ -0,0 +1,12 @@
#import "MWMEditorCommon.h"
#import "MWMTableViewCell.h"
#include "indexer/yes_no_unknown.hpp"
@interface MWMEditorSegmentedTableViewCell : MWMTableViewCell
- (void)configWithDelegate:(id<MWMEditorCellProtocol>)delegate
icon:(UIImage *)icon
text:(NSString *)text
value:(YesNoUnknown)value;
@end

View file

@ -0,0 +1,82 @@
#import "MWMEditorSegmentedTableViewCell.hpp"
#import "SwiftBridge.h"
@interface MWMEditorSegmentedTableViewCell ()
@property(weak, nonatomic) IBOutlet UIImageView * icon;
@property(weak, nonatomic) IBOutlet UILabel * label;
@property(weak, nonatomic) IBOutlet UISegmentedControl * segmentedControl;
@property(weak, nonatomic) id<MWMEditorCellProtocol> delegate;
@end
@implementation MWMEditorSegmentedTableViewCell
- (void)configWithDelegate:(id<MWMEditorCellProtocol>)delegate
icon:(UIImage *)icon
text:(NSString *)text
value:(YesNoUnknown)value
{
self.delegate = delegate;
self.icon.image = icon;
self.icon.styleName = @"MWMBlack";
self.label.text = text;
[self.segmentedControl setTitle:NSLocalizedString(@"no", nil) forSegmentAtIndex:0];
[self.segmentedControl setTitle:NSLocalizedString(@"yes", nil) forSegmentAtIndex:2];
switch(value)
{
case Yes:
self.segmentedControl.selectedSegmentIndex = 2;
break;
case No:
self.segmentedControl.selectedSegmentIndex = 0;
break;
case Unknown:
self.segmentedControl.selectedSegmentIndex = 1;
break;
}
[self setTextColorWithSegmentedValue:value];
}
- (void)setTextColorWithSegmentedValue:(YesNoUnknown)value
{
switch (value)
{
case Yes:
case No:
self.label.textColor = [UIColor blackPrimaryText];
break;
case Unknown:
self.label.textColor = [UIColor blackHintText];
break;
}
}
- (IBAction)valueChanged
{
YesNoUnknown value;
switch (self.segmentedControl.selectedSegmentIndex)
{
case 0:
value = No;
break;
case 1:
value = Unknown;
break;
case 2:
value = Yes;
break;
default:
value = Unknown;
NSAssert(false, @"Unexpected YesNoUnknown value %ld", static_cast<long>(self.segmentedControl.selectedSegmentIndex));
}
[self.delegate cell:self changeSegmented:value];
[self setTextColorWithSegmentedValue:value];
}
@end

View file

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22684"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="qme-9J-aMf" customClass="MWMEditorSegmentedTableViewCell" propertyAccessControl="none">
<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="qme-9J-aMf" id="fpo-VO-awT">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="j3u-fF-pG6">
<rect key="frame" x="16" y="8" width="28" height="28"/>
<constraints>
<constraint firstAttribute="height" constant="28" id="Ce3-kg-QsX"/>
<constraint firstAttribute="width" constant="28" id="MT3-eQ-SOL"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMBlack"/>
</userDefinedRuntimeAttributes>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="187" translatesAutoresizingMaskIntoConstraints="NO" id="QFf-wR-pPw">
<rect key="frame" x="60" y="0.0" width="133" height="44"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" priority="750" constant="44" id="XYk-fv-D9R"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17:blackPrimaryText"/>
</userDefinedRuntimeAttributes>
</label>
<segmentedControl opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" contentHorizontalAlignment="left" contentVerticalAlignment="top" apportionsSegmentWidthsByContent="YES" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="Rp8-YJ-AzV">
<rect key="frame" x="201" y="6.5" width="103" height="32"/>
<segments>
<segment title="No"/>
<segment title="-"/>
<segment title="Yes"/>
</segments>
<connections>
<action selector="valueChanged" destination="qme-9J-aMf" eventType="valueChanged" id="jR4-p8-Ldo"/>
</connections>
</segmentedControl>
</subviews>
<constraints>
<constraint firstItem="QFf-wR-pPw" firstAttribute="top" secondItem="fpo-VO-awT" secondAttribute="top" id="3mH-Ua-EUl"/>
<constraint firstItem="j3u-fF-pG6" firstAttribute="centerY" secondItem="fpo-VO-awT" secondAttribute="centerY" id="4xr-PJ-Dl2"/>
<constraint firstItem="j3u-fF-pG6" firstAttribute="leading" secondItem="fpo-VO-awT" secondAttribute="leading" constant="16" id="TFM-QG-P2e"/>
<constraint firstAttribute="bottom" secondItem="QFf-wR-pPw" secondAttribute="bottom" id="YAg-Wx-DLo"/>
<constraint firstItem="Rp8-YJ-AzV" firstAttribute="centerY" secondItem="fpo-VO-awT" secondAttribute="centerY" id="aTy-ab-vvF"/>
<constraint firstItem="Rp8-YJ-AzV" firstAttribute="leading" secondItem="QFf-wR-pPw" secondAttribute="trailing" constant="8" id="ge8-tr-S4S"/>
<constraint firstItem="QFf-wR-pPw" firstAttribute="leading" secondItem="fpo-VO-awT" secondAttribute="leading" constant="60" id="mNR-IV-cek"/>
<constraint firstAttribute="trailing" secondItem="Rp8-YJ-AzV" secondAttribute="trailing" constant="16" id="z6B-PV-rXg"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
</userDefinedRuntimeAttributes>
</tableViewCellContentView>
<inset key="separatorInset" minX="60" minY="0.0" maxX="0.0" maxY="0.0"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
</userDefinedRuntimeAttributes>
<connections>
<outlet property="icon" destination="j3u-fF-pG6" id="nIz-cY-MCW"/>
<outlet property="label" destination="QFf-wR-pPw" id="1MO-Vf-bt6"/>
<outlet property="segmentedControl" destination="Rp8-YJ-AzV" id="C9T-O3-dMM"/>
</connections>
<point key="canvasLocation" x="137.59999999999999" y="154.72263868065968"/>
</tableViewCell>
</objects>
</document>

View file

@ -0,0 +1,11 @@
#import "MWMEditorCommon.h"
#import "MWMTableViewCell.h"
@interface MWMEditorSelectTableViewCell : MWMTableViewCell
- (void)configWithDelegate:(id<MWMEditorCellProtocol>)delegate
icon:(UIImage *)icon
text:(NSString *)text
placeholder:(NSString *)placeholder;
@end

View file

@ -0,0 +1,46 @@
#import "MWMEditorSelectTableViewCell.h"
#import <CoreApi/MWMCommon.h>
#import "SwiftBridge.h"
@interface MWMEditorSelectTableViewCell ()
@property(weak, nonatomic) IBOutlet UIImageView * icon;
@property(weak, nonatomic) IBOutlet UILabel * label;
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * labelLeadingOffset;
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * labelTrailingOffset;
@property(weak, nonatomic) IBOutlet UIImageView * grayArrow;
@property(weak, nonatomic) id<MWMEditorCellProtocol> delegate;
@end
@implementation MWMEditorSelectTableViewCell
- (void)configWithDelegate:(id<MWMEditorCellProtocol>)delegate
icon:(UIImage *)icon
text:(NSString *)text
placeholder:(NSString *)placeholder
{
self.delegate = delegate;
self.icon.hidden = NO;
self.icon.image = icon;
self.icon.styleName = @"MWMBlack";
if (text && text.length != 0)
{
self.label.text = text;
[self.label setStyleNameAndApply: @"blackPrimaryText"];
}
else
{
self.label.text = placeholder;
[self.label setStyleNameAndApply: @"blackHintText"];
}
self.label.preferredMaxLayoutWidth =
self.width - self.labelLeadingOffset.constant - self.labelTrailingOffset.constant;
if (isInterfaceRightToLeft())
self.grayArrow.transform = CGAffineTransformMakeScale(-1, 1);
}
- (IBAction)selectAction { [self.delegate cellDidPressButton:self]; }
@end

View file

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<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="xiI-ev-aU2" customClass="MWMEditorSelectTableViewCell" propertyAccessControl="none">
<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="xiI-ev-aU2" id="V1p-K9-KlE">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="xur-tJ-HA9">
<rect key="frame" x="16" y="8" width="28" height="28"/>
<constraints>
<constraint firstAttribute="width" constant="28" id="Oak-eT-K2q"/>
<constraint firstAttribute="height" constant="28" id="s7g-CH-05Z"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMBlack"/>
</userDefinedRuntimeAttributes>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="220" translatesAutoresizingMaskIntoConstraints="NO" id="MBe-6r-IsA">
<rect key="frame" x="60" y="8" width="220" height="28"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" priority="750" constant="28" id="7cv-Wq-vWC"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17:blackPrimaryText"/>
</userDefinedRuntimeAttributes>
</label>
<imageView userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_arrow_gray_right" translatesAutoresizingMaskIntoConstraints="NO" id="jLw-GA-z3y">
<rect key="frame" x="286" y="8" width="28" height="28"/>
<constraints>
<constraint firstAttribute="width" constant="28" id="Ki5-4h-NRK"/>
<constraint firstAttribute="height" constant="28" id="PG8-LW-72y"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMGray"/>
</userDefinedRuntimeAttributes>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="nq9-KC-Ujh">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<connections>
<action selector="selectAction" destination="xiI-ev-aU2" eventType="touchUpInside" id="xXk-7q-LQQ"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="jLw-GA-z3y" secondAttribute="trailing" constant="6" id="3Bg-20-t7E"/>
<constraint firstAttribute="trailing" secondItem="nq9-KC-Ujh" secondAttribute="trailing" id="5gd-06-ZOC"/>
<constraint firstItem="MBe-6r-IsA" firstAttribute="top" secondItem="V1p-K9-KlE" secondAttribute="top" constant="8" id="6FB-in-VCz"/>
<constraint firstAttribute="bottom" secondItem="MBe-6r-IsA" secondAttribute="bottom" constant="8" id="CG0-ar-vx9"/>
<constraint firstItem="xur-tJ-HA9" firstAttribute="leading" secondItem="V1p-K9-KlE" secondAttribute="leading" constant="16" id="DlR-yh-2JK"/>
<constraint firstItem="MBe-6r-IsA" firstAttribute="leading" secondItem="V1p-K9-KlE" secondAttribute="leading" constant="60" id="RGA-XL-gLq"/>
<constraint firstItem="xur-tJ-HA9" firstAttribute="centerY" secondItem="V1p-K9-KlE" secondAttribute="centerY" id="agx-Kf-DpK"/>
<constraint firstAttribute="bottom" secondItem="nq9-KC-Ujh" secondAttribute="bottom" id="fK8-AO-JKa"/>
<constraint firstItem="nq9-KC-Ujh" firstAttribute="top" secondItem="V1p-K9-KlE" secondAttribute="top" id="ibI-hy-19F"/>
<constraint firstItem="jLw-GA-z3y" firstAttribute="centerY" secondItem="V1p-K9-KlE" secondAttribute="centerY" id="nY0-7m-bcZ"/>
<constraint firstItem="nq9-KC-Ujh" firstAttribute="leading" secondItem="V1p-K9-KlE" secondAttribute="leading" id="tyN-aq-pC1"/>
<constraint firstAttribute="trailing" secondItem="MBe-6r-IsA" secondAttribute="trailing" constant="40" id="yG7-RB-5Pa"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
</userDefinedRuntimeAttributes>
</tableViewCellContentView>
<inset key="separatorInset" minX="60" minY="0.0" maxX="0.0" maxY="0.0"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
</userDefinedRuntimeAttributes>
<connections>
<outlet property="grayArrow" destination="jLw-GA-z3y" id="5NK-K5-4IO"/>
<outlet property="icon" destination="xur-tJ-HA9" id="ObZ-fc-tbA"/>
<outlet property="label" destination="MBe-6r-IsA" id="mvf-Q3-vMz"/>
<outlet property="labelLeadingOffset" destination="RGA-XL-gLq" id="Tb4-Ew-iDe"/>
<outlet property="labelTrailingOffset" destination="yG7-RB-5Pa" id="NqK-3D-zMQ"/>
</connections>
<point key="canvasLocation" x="139" y="155"/>
</tableViewCell>
</objects>
<resources>
<image name="ic_arrow_gray_right" width="28" height="28"/>
</resources>
</document>

View file

@ -0,0 +1,11 @@
#import "MWMEditorCommon.h"
#import "MWMTableViewCell.h"
@interface MWMEditorSwitchTableViewCell : MWMTableViewCell
- (void)configWithDelegate:(id<MWMEditorCellProtocol>)delegate
icon:(UIImage *)icon
text:(NSString *)text
on:(BOOL)on;
@end

View file

@ -0,0 +1,41 @@
#import "MWMEditorSwitchTableViewCell.h"
#import "SwiftBridge.h"
@interface MWMEditorSwitchTableViewCell ()
@property(weak, nonatomic) IBOutlet UIImageView * icon;
@property(weak, nonatomic) IBOutlet UILabel * label;
@property(weak, nonatomic) IBOutlet UISwitch * switchControl;
@property(weak, nonatomic) id<MWMEditorCellProtocol> delegate;
@end
@implementation MWMEditorSwitchTableViewCell
- (void)configWithDelegate:(id<MWMEditorCellProtocol>)delegate
icon:(UIImage *)icon
text:(NSString *)text
on:(BOOL)on
{
self.delegate = delegate;
self.icon.image = icon;
self.icon.styleName = @"MWMBlack";
self.label.text = text;
self.switchControl.on = on;
[self setTextColorWithSwitchValue:on];
}
- (void)setTextColorWithSwitchValue:(BOOL)value
{
self.label.textColor = value ? [UIColor blackPrimaryText] : [UIColor blackHintText];
}
- (IBAction)valueChanged
{
BOOL const value = self.switchControl.on;
[self.delegate cell:self changeSwitch:value];
[self setTextColorWithSwitchValue:value];
}
@end

View file

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="qme-9J-aMf" customClass="MWMEditorSwitchTableViewCell" propertyAccessControl="none">
<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="qme-9J-aMf" id="fpo-VO-awT">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="j3u-fF-pG6">
<rect key="frame" x="16" y="8" width="28" height="28"/>
<constraints>
<constraint firstAttribute="height" constant="28" id="Ce3-kg-QsX"/>
<constraint firstAttribute="width" constant="28" id="MT3-eQ-SOL"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMBlack"/>
</userDefinedRuntimeAttributes>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="187" translatesAutoresizingMaskIntoConstraints="NO" id="QFf-wR-pPw">
<rect key="frame" x="60" y="0.0" width="187" height="44"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" priority="750" constant="44" id="XYk-fv-D9R"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17:blackPrimaryText"/>
</userDefinedRuntimeAttributes>
</label>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="qvr-u3-nNo">
<rect key="frame" x="255" y="6.5" width="51" height="31"/>
<connections>
<action selector="valueChanged" destination="qme-9J-aMf" eventType="valueChanged" id="sak-SB-Nvi"/>
</connections>
</switch>
</subviews>
<constraints>
<constraint firstItem="QFf-wR-pPw" firstAttribute="top" secondItem="fpo-VO-awT" secondAttribute="top" id="3mH-Ua-EUl"/>
<constraint firstItem="j3u-fF-pG6" firstAttribute="centerY" secondItem="fpo-VO-awT" secondAttribute="centerY" id="4xr-PJ-Dl2"/>
<constraint firstAttribute="trailing" secondItem="qvr-u3-nNo" secondAttribute="trailing" constant="16" id="T2E-Dp-9aj"/>
<constraint firstItem="j3u-fF-pG6" firstAttribute="leading" secondItem="fpo-VO-awT" secondAttribute="leading" constant="16" id="TFM-QG-P2e"/>
<constraint firstAttribute="bottom" secondItem="QFf-wR-pPw" secondAttribute="bottom" id="YAg-Wx-DLo"/>
<constraint firstItem="qvr-u3-nNo" firstAttribute="leading" secondItem="QFf-wR-pPw" secondAttribute="trailing" constant="8" id="m7G-DT-9Wm"/>
<constraint firstItem="QFf-wR-pPw" firstAttribute="leading" secondItem="fpo-VO-awT" secondAttribute="leading" constant="60" id="mNR-IV-cek"/>
<constraint firstItem="qvr-u3-nNo" firstAttribute="centerY" secondItem="fpo-VO-awT" secondAttribute="centerYWithinMargins" id="opz-Nt-Q5b"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
</userDefinedRuntimeAttributes>
</tableViewCellContentView>
<inset key="separatorInset" minX="60" minY="0.0" maxX="0.0" maxY="0.0"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
</userDefinedRuntimeAttributes>
<connections>
<outlet property="icon" destination="j3u-fF-pG6" id="nIz-cY-MCW"/>
<outlet property="label" destination="QFf-wR-pPw" id="1MO-Vf-bt6"/>
<outlet property="switchControl" destination="qvr-u3-nNo" id="hfe-x6-0cw"/>
</connections>
<point key="canvasLocation" x="139" y="155"/>
</tableViewCell>
</objects>
</document>

View file

@ -0,0 +1,25 @@
#import "MWMTableViewCell.h"
@protocol MWMEditorCellProtocol;
@interface MWMEditorTextTableViewCell : MWMTableViewCell
- (void)configWithDelegate:(id<MWMEditorCellProtocol>)delegate
icon:(UIImage *)icon
text:(NSString *)text
placeholder:(NSString *)placeholder
keyboardType:(UIKeyboardType)keyboardType
capitalization:(UITextAutocapitalizationType)capitalization;
- (void)configWithDelegate:(id<MWMEditorCellProtocol>)delegate
icon:(UIImage *)icon
text:(NSString *)text
placeholder:(NSString *)placeholder
errorMessage:(NSString *)errorMessage
isValid:(BOOL)isValid
keyboardType:(UIKeyboardType)keyboardType
capitalization:(UITextAutocapitalizationType)capitalization;
@property(weak, nonatomic, readonly) IBOutlet UITextField * textField;
@end

View file

@ -0,0 +1,120 @@
#import "MWMEditorTextTableViewCell.h"
#import "MWMEditorCommon.h"
#import "UIImageView+Coloring.h"
#import "SwiftBridge.h"
static CGFloat const kErrorLabelDefaultTopSpace = 4.;
@interface MWMEditorTextTableViewCell ()<UITextFieldDelegate>
@property(weak, nonatomic) IBOutlet UIImageView * icon;
@property(weak, nonatomic, readwrite) IBOutlet UITextField * textField;
@property(weak, nonatomic) IBOutlet UILabel * errorLabel;
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * errorLabelTopSpace;
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * labelHeight;
@property(weak, nonatomic) id<MWMEditorCellProtocol> delegate;
@property(nonatomic) BOOL isValid;
@end
@implementation MWMEditorTextTableViewCell
- (void)configWithDelegate:(id<MWMEditorCellProtocol>)delegate
icon:(UIImage *)icon
text:(NSString *)text
placeholder:(NSString *)placeholder
keyboardType:(UIKeyboardType)keyboardType
capitalization:(UITextAutocapitalizationType)capitalization
{
[self configWithDelegate:delegate
icon:icon
text:text
placeholder:placeholder
errorMessage:nil
isValid:YES
keyboardType:keyboardType
capitalization:capitalization];
}
- (void)configWithDelegate:(id<MWMEditorCellProtocol>)delegate
icon:(UIImage *)icon
text:(NSString *)text
placeholder:(NSString *)placeholder
errorMessage:(NSString *)errorMessage
isValid:(BOOL)isValid
keyboardType:(UIKeyboardType)keyboardType
capitalization:(UITextAutocapitalizationType)capitalization
{
self.delegate = delegate;
self.icon.image = icon;
[self.icon setStyleNameAndApply: @"MWMBlack"];
self.icon.hidden = (icon == nil);
self.textField.text = text;
self.textField.attributedPlaceholder = [[NSAttributedString alloc]
initWithString:placeholder
attributes:@{NSForegroundColorAttributeName : [UIColor blackHintText]}];
self.errorLabel.text = errorMessage;
self.textField.keyboardType = keyboardType;
self.textField.backgroundColor = UIColor.clearColor;
self.isValid = isValid;
self.textField.autocapitalizationType = capitalization;
[self processValidation];
}
- (void)processValidation
{
if (self.isValid)
{
self.labelHeight.priority = UILayoutPriorityDefaultHigh;
self.errorLabelTopSpace.constant = 0.;
[self.contentView setStyleNameAndApply: @"Background"];
}
else
{
self.labelHeight.priority = UILayoutPriorityDefaultLow;
self.errorLabelTopSpace.constant = kErrorLabelDefaultTopSpace;
[self.contentView setStyleNameAndApply: @"ErrorBackground"];
}
[self layoutIfNeeded];
}
- (void)changeInvalidCellState
{
if (self.isValid)
return;
self.isValid = YES;
[self processValidation];
[self.delegate tryToChangeInvalidStateForCell:self];
}
#pragma mark - UITextFieldDelegate
- (BOOL)textField:(UITextField *)textField
shouldChangeCharactersInRange:(NSRange)range
replacementString:(NSString *)string
{
[self changeInvalidCellState];
return YES;
}
- (BOOL)textFieldShouldClear:(UITextField *)textField
{
[self changeInvalidCellState];
return YES;
}
- (void)textFieldDidEndEditing:(UITextField *)textField
{
[self.delegate cell:self changedText:textField.text];
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField resignFirstResponder];
return YES;
}
@end

View file

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="56" id="KGk-i7-Jjw" customClass="MWMEditorTextTableViewCell">
<rect key="frame" x="0.0" y="0.0" width="320" height="59"/>
<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="59"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="5uK-5Q-cg0">
<rect key="frame" x="16" y="15.5" width="28" height="28"/>
<constraints>
<constraint firstAttribute="height" constant="28" id="6Kb-wI-H3V"/>
<constraint firstAttribute="width" constant="28" id="nbm-T8-Yob"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMBlack"/>
</userDefinedRuntimeAttributes>
</imageView>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="bottom" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="krN-k2-9qO">
<rect key="frame" x="60" y="0.0" width="252" height="28"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" priority="750" constant="28" id="P3n-mD-g5V"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17:blackPrimaryText"/>
</userDefinedRuntimeAttributes>
<connections>
<outlet property="delegate" destination="KGk-i7-Jjw" id="GO4-EB-MG9"/>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="252" translatesAutoresizingMaskIntoConstraints="NO" id="Lht-i1-s0H">
<rect key="frame" x="60" y="32" width="252" height="15"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" priority="250" id="2X4-TJ-v2V"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.95686274510000002" green="0.26274509800000001" blue="0.21176470589999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular12:redText"/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="Lht-i1-s0H" secondAttribute="bottom" constant="12" id="DhN-vK-bTb"/>
<constraint firstItem="Lht-i1-s0H" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="60" id="EIo-KA-vQX"/>
<constraint firstItem="krN-k2-9qO" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="M6R-qw-860"/>
<constraint firstAttribute="trailing" secondItem="krN-k2-9qO" secondAttribute="trailing" constant="8" id="O2l-xa-4ZO"/>
<constraint firstItem="Lht-i1-s0H" firstAttribute="top" secondItem="krN-k2-9qO" secondAttribute="bottom" constant="4" id="WLe-gG-Nur"/>
<constraint firstAttribute="trailing" secondItem="Lht-i1-s0H" secondAttribute="trailing" constant="8" id="bkK-l2-xGd"/>
<constraint firstItem="5uK-5Q-cg0" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerYWithinMargins" id="mZL-51-0kV"/>
<constraint firstItem="5uK-5Q-cg0" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="ufn-3T-MOd"/>
<constraint firstItem="krN-k2-9qO" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="60" id="w8z-Hi-yGr"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
</userDefinedRuntimeAttributes>
</tableViewCellContentView>
<inset key="separatorInset" minX="60" minY="0.0" maxX="0.0" maxY="0.0"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
</userDefinedRuntimeAttributes>
<connections>
<outlet property="errorLabel" destination="Lht-i1-s0H" id="N2I-je-OSW"/>
<outlet property="errorLabelTopSpace" destination="WLe-gG-Nur" id="shl-Rd-fU4"/>
<outlet property="icon" destination="5uK-5Q-cg0" id="5du-LU-RmA"/>
<outlet property="labelHeight" destination="2X4-TJ-v2V" id="5jn-qt-Ma7"/>
<outlet property="textField" destination="krN-k2-9qO" id="Fqg-H9-JpU"/>
</connections>
<point key="canvasLocation" x="327" y="351"/>
</tableViewCell>
</objects>
</document>

View file

@ -0,0 +1,27 @@
#import "MWMTableViewCell.h"
@class MWMNoteCell;
NS_ASSUME_NONNULL_BEGIN
@protocol MWMNoteCellDelegate <NSObject>
- (void)cell:(MWMNoteCell *)cell didChangeSizeAndText:(NSString *)text;
- (void)cell:(MWMNoteCell *)cell didFinishEditingWithText:(NSString *)text;
@end
@interface MWMNoteCell : MWMTableViewCell
@property(nonatomic, readonly, class) CGFloat minimalHeight;
@property(nonatomic, readonly) CGFloat cellHeight;
@property(nonatomic, readonly) CGFloat textViewContentHeight;
- (void)configWithDelegate:(id<MWMNoteCellDelegate>)delegate
noteText:(NSString *)text
placeholder:(NSString *)placeholder;
- (void)updateTextViewForHeight:(CGFloat)height;
@end
NS_ASSUME_NONNULL_END

View file

@ -0,0 +1,87 @@
#import "MWMNoteCell.h"
#import "MWMTextView.h"
static CGFloat const kTopTextViewOffset = 12.;
static NSString *const kTextViewContentSizeKeyPath = @"contentSize";
static CGFloat const kMinimalTextViewHeight = 44.;
static void *kContext = &kContext;
@interface MWMNoteCell () <UITextViewDelegate>
@property(nonatomic) IBOutlet MWMTextView *textView;
@property(nonatomic) IBOutlet NSLayoutConstraint *textViewHeight;
@property(weak, nonatomic) id<MWMNoteCellDelegate> delegate;
@end
@implementation MWMNoteCell
- (void)configWithDelegate:(id<MWMNoteCellDelegate>)delegate
noteText:(NSString *)text
placeholder:(NSString *)placeholder {
self.delegate = delegate;
self.textView.text = text;
self.textView.keyboardAppearance = [UIColor isNightMode] ? UIKeyboardAppearanceDark : UIKeyboardAppearanceDefault;
self.textView.placeholder = placeholder;
}
- (void)updateTextViewForHeight:(CGFloat)height {
id<MWMNoteCellDelegate> delegate = self.delegate;
if (height > kMinimalTextViewHeight) {
[delegate cell:self didChangeSizeAndText:self.textView.text];
}
[self setNeedsLayout];
}
- (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary *)change
context:(void *)context {
if (context == kContext) {
NSValue *s = change[NSKeyValueChangeNewKey];
CGFloat height = s.CGSizeValue.height;
[self updateTextViewForHeight:height];
return;
}
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
- (CGFloat)cellHeight {
return self.textViewHeight.constant + 2 * kTopTextViewOffset;
}
- (CGFloat)textViewContentHeight {
return self.textView.contentSize.height;
}
+ (CGFloat)minimalHeight {
return kMinimalTextViewHeight;
}
- (void)textViewDidEndEditing:(UITextView *)textView {
[self.delegate cell:self didFinishEditingWithText:textView.text];
[self unregisterObserver];
}
- (void)textViewDidBeginEditing:(UITextView *)textView {
[self registerObserver];
}
- (void)textViewDidChange:(UITextView *)textView {
[textView sizeToFit];
}
- (void)unregisterObserver {
[self.textView removeObserver:self forKeyPath:kTextViewContentSizeKeyPath context:kContext];
}
- (void)registerObserver {
[self.textView addObserver:self
forKeyPath:kTextViewContentSizeKeyPath
options:NSKeyValueObservingOptionNew
context:kContext];
}
@end

View file

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="129" id="KGk-i7-Jjw" customClass="MWMNoteCell" propertyAccessControl="none">
<rect key="frame" x="0.0" y="0.0" width="320" height="129"/>
<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="129"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="d32-xF-MvW" customClass="MWMTextView">
<rect key="frame" x="16" y="12" width="288" height="105"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="44" id="J3M-HG-f2p"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background:regular17:blackPrimaryText"/>
</userDefinedRuntimeAttributes>
<connections>
<outlet property="delegate" destination="KGk-i7-Jjw" id="b3Z-HX-D7g"/>
</connections>
</textView>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="d32-xF-MvW" secondAttribute="trailing" constant="16" id="Ost-1C-1e0"/>
<constraint firstItem="d32-xF-MvW" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="VYR-fH-Xju"/>
<constraint firstAttribute="bottom" secondItem="d32-xF-MvW" secondAttribute="bottom" constant="12" id="X92-RT-6WG"/>
<constraint firstItem="d32-xF-MvW" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="12" id="YRt-nX-DIa"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="textView" destination="d32-xF-MvW" id="dwC-Cl-3Pl"/>
<outlet property="textViewHeight" destination="J3M-HG-f2p" id="rK2-Hv-d1g"/>
</connections>
<point key="canvasLocation" x="334" y="383"/>
</tableViewCell>
</objects>
</document>