Adds a label to the integer form field.
Makes the string value and both string and integer label update the underlying controls when set.
This commit is contained in:
@@ -262,7 +262,7 @@
|
|||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="RCc-cF-BI3" userLabel="Text Field">
|
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="RCc-cF-BI3" userLabel="Text Field">
|
||||||
<rect key="frame" x="20" y="5" width="254" height="34"/>
|
<rect key="frame" x="82" y="5" width="192" height="34"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="height" constant="34" id="8Nj-FL-Ab6"/>
|
<constraint firstAttribute="height" constant="34" id="8Nj-FL-Ab6"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
@@ -282,16 +282,28 @@
|
|||||||
<action selector="stepperValueChanged:" destination="KwC-8P-1dy" eventType="valueChanged" id="BKh-dh-f3d"/>
|
<action selector="stepperValueChanged:" destination="KwC-8P-1dy" eventType="valueChanged" id="BKh-dh-f3d"/>
|
||||||
</connections>
|
</connections>
|
||||||
</stepper>
|
</stepper>
|
||||||
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7nN-Bo-Jgm">
|
||||||
|
<rect key="frame" x="20" y="11.5" width="42" height="21"/>
|
||||||
|
<constraints>
|
||||||
|
<constraint firstAttribute="height" constant="21" id="x72-wj-jT3"/>
|
||||||
|
</constraints>
|
||||||
|
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||||
|
<nil key="textColor"/>
|
||||||
|
<nil key="highlightedColor"/>
|
||||||
|
</label>
|
||||||
</subviews>
|
</subviews>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstItem="vgc-Rg-Zc8" firstAttribute="centerY" secondItem="Dwe-Tg-VQ6" secondAttribute="centerY" id="6as-ZA-8B4"/>
|
<constraint firstItem="vgc-Rg-Zc8" firstAttribute="centerY" secondItem="Dwe-Tg-VQ6" secondAttribute="centerY" id="6as-ZA-8B4"/>
|
||||||
<constraint firstAttribute="trailing" secondItem="vgc-Rg-Zc8" secondAttribute="trailing" constant="20" id="GHC-1H-v20"/>
|
<constraint firstAttribute="trailingMargin" secondItem="vgc-Rg-Zc8" secondAttribute="trailing" id="GHC-1H-v20"/>
|
||||||
|
<constraint firstItem="7nN-Bo-Jgm" firstAttribute="centerY" secondItem="Dwe-Tg-VQ6" secondAttribute="centerY" id="Rcx-L4-hEN"/>
|
||||||
|
<constraint firstItem="7nN-Bo-Jgm" firstAttribute="leading" secondItem="Dwe-Tg-VQ6" secondAttribute="leadingMargin" id="SQY-8s-eLf"/>
|
||||||
|
<constraint firstItem="RCc-cF-BI3" firstAttribute="leading" secondItem="7nN-Bo-Jgm" secondAttribute="trailing" constant="20" id="So8-Uf-Zfa"/>
|
||||||
<constraint firstItem="vgc-Rg-Zc8" firstAttribute="leading" secondItem="RCc-cF-BI3" secondAttribute="trailing" constant="20" id="T1Y-Pj-gsO"/>
|
<constraint firstItem="vgc-Rg-Zc8" firstAttribute="leading" secondItem="RCc-cF-BI3" secondAttribute="trailing" constant="20" id="T1Y-Pj-gsO"/>
|
||||||
<constraint firstItem="RCc-cF-BI3" firstAttribute="centerY" secondItem="Dwe-Tg-VQ6" secondAttribute="centerY" id="ett-1I-J0L"/>
|
<constraint firstItem="RCc-cF-BI3" firstAttribute="centerY" secondItem="Dwe-Tg-VQ6" secondAttribute="centerY" id="ett-1I-J0L"/>
|
||||||
<constraint firstItem="RCc-cF-BI3" firstAttribute="leading" secondItem="Dwe-Tg-VQ6" secondAttribute="leading" constant="20" id="mBk-4r-ebJ"/>
|
|
||||||
</constraints>
|
</constraints>
|
||||||
</tableViewCellContentView>
|
</tableViewCellContentView>
|
||||||
<connections>
|
<connections>
|
||||||
|
<outlet property="labelView" destination="7nN-Bo-Jgm" id="TC4-Xt-Rrb"/>
|
||||||
<outlet property="stepper" destination="vgc-Rg-Zc8" id="QT0-L8-npw"/>
|
<outlet property="stepper" destination="vgc-Rg-Zc8" id="QT0-L8-npw"/>
|
||||||
<outlet property="textField" destination="RCc-cF-BI3" id="JpG-sb-BPS"/>
|
<outlet property="textField" destination="RCc-cF-BI3" id="JpG-sb-BPS"/>
|
||||||
</connections>
|
</connections>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@property (weak, nonatomic) id<MCFormFieldDelegate> delegate;
|
@property (weak, nonatomic) id<MCFormFieldDelegate> delegate;
|
||||||
@property (weak, nonatomic) IBOutlet UITextField *textField;
|
@property (weak, nonatomic) IBOutlet UITextField *textField;
|
||||||
@property (weak, nonatomic) IBOutlet UIStepper *stepper;
|
@property (weak, nonatomic) IBOutlet UIStepper *stepper;
|
||||||
|
@property (weak, nonatomic) IBOutlet UILabel *labelView;
|
||||||
- (IBAction)stepperValueChanged:(id)sender;
|
- (IBAction)stepperValueChanged:(id)sender;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -34,6 +34,24 @@
|
|||||||
return _value;
|
return _value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@synthesize label = _label;
|
||||||
|
|
||||||
|
- (void)setLabel:(NSString*)label {
|
||||||
|
if (![_label isEqualToString:label]) {
|
||||||
|
_label = label;
|
||||||
|
if (self.textField) {
|
||||||
|
self.textField.placeholder = label;
|
||||||
|
}
|
||||||
|
if (self.labelView) {
|
||||||
|
self.labelView.text = label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString*)label {
|
||||||
|
return _label;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)awakeFromNib {
|
- (void)awakeFromNib {
|
||||||
[super awakeFromNib];
|
[super awakeFromNib];
|
||||||
[self.textField addTarget:self
|
[self.textField addTarget:self
|
||||||
|
|||||||
@@ -10,6 +10,36 @@
|
|||||||
|
|
||||||
@implementation MCShortStringFieldTableViewCell
|
@implementation MCShortStringFieldTableViewCell
|
||||||
|
|
||||||
|
@synthesize value = _value;
|
||||||
|
|
||||||
|
- (void)setValue:(NSString*)value {
|
||||||
|
if (![_value isEqualToString:value]) {
|
||||||
|
_value = value;
|
||||||
|
if (self.textField) {
|
||||||
|
self.textField.text = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString*)value {
|
||||||
|
return _value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@synthesize label = _label;
|
||||||
|
|
||||||
|
- (void)setLabel:(NSString*)label {
|
||||||
|
if (![_label isEqualToString:label]) {
|
||||||
|
_label = label;
|
||||||
|
if (self.textField) {
|
||||||
|
self.textField.placeholder = label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString*)label {
|
||||||
|
return _label;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)awakeFromNib {
|
- (void)awakeFromNib {
|
||||||
[super awakeFromNib];
|
[super awakeFromNib];
|
||||||
[self.textField addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventEditingChanged];
|
[self.textField addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventEditingChanged];
|
||||||
|
|||||||
Reference in New Issue
Block a user