textfield delegate object fix

This commit is contained in:
Pfeil, Scott Robert 2019-04-15 14:39:37 -04:00
parent 01c5abc027
commit e2e6cbabf6

View File

@ -116,7 +116,7 @@
+ (nullable instancetype)mfTextFieldWithMap:(nullable NSDictionary *)map bothDelegates:(nullable id<UITextFieldDelegate, MFTextFieldDelegate>)delegate { + (nullable instancetype)mfTextFieldWithMap:(nullable NSDictionary *)map bothDelegates:(nullable id<UITextFieldDelegate, MFTextFieldDelegate>)delegate {
MFTextField *textField = [self mfTextField]; MFTextField *textField = [self mfTextField];
textField.translatesAutoresizingMaskIntoConstraints = NO; textField.translatesAutoresizingMaskIntoConstraints = NO;
[textField setWithJSON:map delegate:delegate additionalData:nil]; [textField setWithJSON:map delegateObject:[MVMCoreUIDelegateObject createWithDelegateForAll:delegate] additionalData:nil];
return textField; return textField;
} }
@ -558,10 +558,12 @@
self.isMolecule = YES; self.isMolecule = YES;
} }
- (void)setWithJSON:(NSDictionary *)json delegate:(nullable id<UITextFieldDelegate, MFTextFieldDelegate>)delegate additionalData:(NSDictionary *)additionalData { - (void)setWithJSON:(NSDictionary *)json delegateObject:(DelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData {
[FormValidator setupValidationWithMolecule:self delegate:(id<FormValidationProtocol>)delegate]; if ([delegateObject isKindOfClass:[MVMCoreUIDelegateObject class]]) {
FormValidator *formValidator = [FormValidator getFormValidatorForDelegate:(id<FormValidationProtocol>)delegate]; [FormValidator setupValidationWithMolecule:self delegate:((MVMCoreUIDelegateObject *)delegateObject).formValidationProtocol];
[self setWithMap:json bothDelegates:formValidator]; FormValidator *formValidator = [FormValidator getFormValidatorForDelegate:((MVMCoreUIDelegateObject *)delegateObject).formValidationProtocol];
[self setWithMap:json bothDelegates:formValidator];
}
} }
#pragma mark - FormValidationProtocol #pragma mark - FormValidationProtocol