Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Delegate for field end editing #13

Merged
merged 1 commit into from

2 participants

@raven

Added delegate for field did end editing, fired upon UIControlEventEditingDidEnd

@chrismiles chrismiles merged commit 0e79b71 into chrismiles:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 26, 2013
  1. @raven
This page is out of date. Refresh to see the latest.
View
10 Demo/EZFormDemo/Classes/Demos/Registration Form/EZFDRegistrationFormViewController.m
@@ -375,6 +375,14 @@ - (void)formInputFinishedOnLastField:(EZForm *)form
}
}
+- (void)form:(EZForm *)form fieldDidEndEditing:(EZFormField *)formField
+{
+ #pragma unused(form)
+
+ NSLog(@"formField:%@ didEndEditing",formField);
+}
+
+
#pragma mark - Control actions
@@ -410,4 +418,4 @@ - (UIView *)findSubviewOfKind:(Class)kind
return nil;
}
-@end
+@end
View
1  EZForm/EZForm/src/EZForm+Private.h
@@ -27,6 +27,7 @@
@interface EZForm (Private)
- (void)formFieldInputFinished:(EZFormField *)formField;
+- (void)formFieldInputDidEnd:(EZFormField *)formField;
- (void)formFieldDidBeginEditing:(EZFormField *)formField;
- (void)formFieldDidChangeValue:(EZFormField *)formField;
- (UIView *)inputAccessoryView;
View
11 EZForm/EZForm/src/EZForm.h
@@ -277,6 +277,17 @@ typedef enum : NSInteger {
*/
- (void)form:(EZForm *)form fieldDidBeginEditing:(EZFormField *)formField;
+/** Tells the delegate that editing ended for the specified field.
+ *
+ * This method tells the delegate that the specified field resigned the first
+ * responder.
+ *
+ * @param form The form containing the field for which editing ended.
+ *
+ * @param formField The form field for which editing end.
+ */
+- (void)form:(EZForm *)form fieldDidEndEditing:(EZFormField *)formField;
+
/** Asks the delegate for the index path to the row containing the user view
* for the specified field.
*
View
13 EZForm/EZForm/src/EZForm.m
@@ -420,6 +420,11 @@ - (void)formFieldInputFinished:(EZFormField *)formField
}
}
+- (void)formFieldInputDidEnd:(EZFormField *)formField
+{
+ [self formFieldDidEndEditing:formField];
+}
+
- (void)formFieldDidBeginEditing:(EZFormField *)formField
{
[self updateInputAccessoryForEditingFormField:formField];
@@ -430,6 +435,14 @@ - (void)formFieldDidBeginEditing:(EZFormField *)formField
}
}
+- (void)formFieldDidEndEditing:(EZFormField *)formField
+{
+ __strong id<EZFormDelegate> delegate = self.delegate;
+ if ([delegate respondsToSelector:@selector(form:fieldDidEndEditing:)]) {
+ [delegate form:self fieldDidEndEditing:formField];
+ }
+}
+
#pragma mark - Input Accessories
View
19 EZForm/EZForm/src/EZFormTextField.m
@@ -102,6 +102,7 @@ - (void)wireUpTextField
textField.delegate = self;
[textField addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
[textField addTarget:self action:@selector(textFieldEditingDidEndOnExit:) forControlEvents:UIControlEventEditingDidEndOnExit];
+ [textField addTarget:self action:@selector(textFieldEditingDidEnd:) forControlEvents:UIControlEventEditingDidEnd];
}
- (void)wireUpTextView
@@ -115,6 +116,7 @@ - (void)wireUpInputControl
EZFormInputControl *inputControl = (EZFormInputControl *)self.userControl;
[inputControl addTarget:self action:@selector(inputControlEditingDidBegin:) forControlEvents:UIControlEventEditingDidBegin];
[inputControl addTarget:self action:@selector(inputControlEditingDidEndOnExit:) forControlEvents:UIControlEventEditingDidEndOnExit];
+ [inputControl addTarget:self action:@selector(inputControlEditingDidEnd:) forControlEvents:UIControlEventEditingDidEnd];
}
- (void)wireUpUserControl
@@ -145,6 +147,7 @@ - (void)unwireTextField
UITextField *textField = (UITextField *)self.userControl;
[textField removeTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
[textField removeTarget:self action:@selector(textFieldEditingDidEndOnExit:) forControlEvents:UIControlEventEditingDidEndOnExit];
+ [textField removeTarget:self action:@selector(textFieldEditingDidEnd:) forControlEvents:UIControlEventEditingDidEnd];
if (textField.delegate == self) textField.delegate = nil;
}
@@ -190,6 +193,14 @@ - (void)textFieldEditingDidEndOnExit:(id)sender
[form formFieldInputFinished:self];
}
+- (void)textFieldEditingDidEnd:(id)sender
+{
+#pragma unused(sender)
+
+ __strong EZForm *form = self.form;
+ [form formFieldInputDidEnd:self];
+}
+
#pragma mark - Input control events
@@ -207,6 +218,14 @@ - (void)inputControlEditingDidEndOnExit:(id)sender
[form formFieldInputFinished:self];
}
+- (void)inputControlEditingDidEnd:(id)sender
+{
+#pragma unused(sender)
+
+ __strong EZForm *form = self.form;
+ [form formFieldInputDidEnd:self];
+}
+
#pragma mark - Is input valid
Something went wrong with that request. Please try again.