diff --git a/MVMCoreUI/Atoms/Buttons/PrimaryButton.m b/MVMCoreUI/Atoms/Buttons/PrimaryButton.m index 9a4c06a1..5a708f2c 100644 --- a/MVMCoreUI/Atoms/Buttons/PrimaryButton.m +++ b/MVMCoreUI/Atoms/Buttons/PrimaryButton.m @@ -13,8 +13,6 @@ #import "MFStyler.h" #import "UIColor+MFConvenience.h" #import - - @import MVMCore.MVMCoreDispatchUtility; @import MVMCore.MVMCoreGetterUtility; @import MVMCore.NSDictionary_MFConvenience; diff --git a/MVMCoreUI/Atoms/TextFields/MFTextField.h b/MVMCoreUI/Atoms/TextFields/MFTextField.h index cc5ccccb..81b4059f 100644 --- a/MVMCoreUI/Atoms/TextFields/MFTextField.h +++ b/MVMCoreUI/Atoms/TextFields/MFTextField.h @@ -127,6 +127,7 @@ - (void)setAccessibilityString:(nullable NSString *)accessibilityString; +// For Validator Protocol - (nullable NSString *)formFieldName; - (nullable id)formFieldValue; diff --git a/MVMCoreUI/Atoms/TextFields/MFTextField.m b/MVMCoreUI/Atoms/TextFields/MFTextField.m index b5dfdcef..565e086c 100644 --- a/MVMCoreUI/Atoms/TextFields/MFTextField.m +++ b/MVMCoreUI/Atoms/TextFields/MFTextField.m @@ -15,9 +15,7 @@ #import "MFLabel.h" #import "MVMCoreUIUtility.h" #import "MVMCoreUIConstants.h" - #import - @import MVMCore.MVMCoreDispatchUtility; @import MVMCore.NSDictionary_MFConvenience; @import MVMCore.MVMCoreJSONConstants; @@ -115,26 +113,6 @@ return textField; } -- (void)setAsMolecule { - self.isMolecule = YES; -} - -- (void)setWithJSON:(NSDictionary *)json delegate:(nullable id)delegate additionalData:(NSDictionary *)additionalData { - [FormValidator setupValidationWithMolecule:self delegate:(id)delegate]; - FormValidator *formValidator = [FormValidator getFormValidatorForDelegate:(id)delegate]; - [self setWithMap:json bothDelegates:formValidator]; -} - -- (void)setHorizontalPadding:(CGFloat) padding { - self.textContainerLeftPin.constant = padding; - self.errorLableLeftPin.constant = padding; - self.formLabelLeftPin.constant = padding; - - self.textContainerRightPin.constant = padding; - self.errorLableRightPin.constant = padding; - self.formLabelRightPin.constant = padding; -} - + (nullable instancetype)mfTextFieldWithMap:(nullable NSDictionary *)map bothDelegates:(nullable id)delegate { MFTextField *textField = [self mfTextField]; textField.translatesAutoresizingMaskIntoConstraints = NO; @@ -390,6 +368,16 @@ }]; } +- (void)setHorizontalPadding:(CGFloat)padding { + self.textContainerLeftPin.constant = padding; + self.errorLableLeftPin.constant = padding; + self.formLabelLeftPin.constant = padding; + + self.textContainerRightPin.constant = padding; + self.errorLableRightPin.constant = padding; + self.formLabelRightPin.constant = padding; +} + - (void)dealloc { [self setBothTextFieldDelegates:nil]; } @@ -566,6 +554,19 @@ #pragma mark - MVMCoreUIMoleculeViewProtocol +- (void)setAsMolecule { + self.isMolecule = YES; +} + +- (void)setWithJSON:(NSDictionary *)json delegate:(nullable id)delegate additionalData:(NSDictionary *)additionalData { + [FormValidator setupValidationWithMolecule:self delegate:(id)delegate]; + FormValidator *formValidator = [FormValidator getFormValidatorForDelegate:(id)delegate]; + [self setWithMap:json bothDelegates:formValidator]; +} + +#pragma mark - FormValidationProtocol + + - (BOOL)isValidField { return self.valid; } @@ -573,6 +574,7 @@ - (nullable NSString *)formFieldName { return self.fieldKey; } + - (nullable id)formFieldValue { return self.text; } diff --git a/MVMCoreUI/BaseControllers/MFViewController.m b/MVMCoreUI/BaseControllers/MFViewController.m index 1b880cc3..c4ee3756 100644 --- a/MVMCoreUI/BaseControllers/MFViewController.m +++ b/MVMCoreUI/BaseControllers/MFViewController.m @@ -37,8 +37,6 @@ #import "MVMCoreUITabBarPageControlViewController.h" #import "MVMCoreUINavigationController.h" #import - - @import MVMAnimationFramework; @interface MFViewController() @@ -411,11 +409,9 @@ [self initialLoad]; } - // Since we have new data, build stuff for the screen. + // Since we have new data, build stuff for the screen and update the ui once the screen is done laying out. [self updateUI]; - // Update the UI after the view is loaded. - self.needToUpdateUI = YES; self.needToupdateUIOnScreenSizeChanges = YES; if (UIAccessibilityIsVoiceOverRunning()) { @@ -427,9 +423,10 @@ } } -- (void) updateUI { +- (void)updateUI { [self newDataBuildScreen]; [self.formValidator enableByValidation]; + self.needToUpdateUI = YES; } - (void)didReceiveMemoryWarning {