fixes with constaints
This commit is contained in:
parent
257cac3794
commit
8282e9a617
@ -21,7 +21,7 @@
|
||||
static const CGFloat FaultTolerance = 20.f;
|
||||
static const CGFloat CheckBoxHeightWidth = 18.0;
|
||||
|
||||
@interface MVMCoreUICheckBox () <FormValidationProtocol>
|
||||
@interface MVMCoreUICheckBox () <FormValidationProtocol, MVMCoreUIMoleculeViewProtocol>
|
||||
|
||||
@property (nonatomic, readwrite) BOOL isSelected;
|
||||
@property (weak, nonatomic) UIView *checkedSquare;
|
||||
@ -42,16 +42,24 @@ static const CGFloat CheckBoxHeightWidth = 18.0;
|
||||
|
||||
@property (nonatomic) BOOL isRequired;
|
||||
@property (nullable, strong, nonatomic) NSString *fieldKey;
|
||||
@property (nullable, weak) DelegateObject *delegate;
|
||||
@property (nullable, strong, nonatomic) DelegateObject *delegate;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MVMCoreUICheckBox
|
||||
|
||||
#pragma mark - convenient class methods
|
||||
#pragma mark - MVMCoreUIMoleculeViewProtocol
|
||||
|
||||
- (BOOL)needsToBeConstrained {
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (UIStackViewAlignment)moleculeAlignment {
|
||||
return UIStackViewAlignmentLeading;
|
||||
}
|
||||
|
||||
- (void)setWithJSON:(NSDictionary *)json delegateObject:(DelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData {
|
||||
|
||||
|
||||
[FormValidator setupValidationWithMolecule:self delegate:((MVMCoreUIDelegateObject *)delegateObject).formValidationProtocol];
|
||||
self.delegate = delegateObject;
|
||||
self.fieldKey = [json stringForKey:KeyFieldKey];
|
||||
@ -70,6 +78,9 @@ static const CGFloat CheckBoxHeightWidth = 18.0;
|
||||
additionalData: additionalData];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - convenient class methods
|
||||
|
||||
+ (instancetype)mfCheckBox {
|
||||
MVMCoreUICheckBox *checkBox = [[self alloc] initWithFrame:CGRectZero];
|
||||
checkBox.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
@ -331,7 +342,7 @@ static const CGFloat CheckBoxHeightWidth = 18.0;
|
||||
[self.checkMark updateCheckSelected:NO animated:animated];
|
||||
}
|
||||
|
||||
FormValidator *formValidator = [FormValidator getFormValidatorForDelegate:((MVMCoreUIDelegateObject *)self.delegate).formValidationProtocol];
|
||||
FormValidator *formValidator = ((MVMCoreUIDelegateObject *)self.delegate).formValidationProtocol.formValidatorModel;
|
||||
[formValidator enableByValidation];
|
||||
}
|
||||
|
||||
|
||||
@ -44,9 +44,6 @@
|
||||
// Pins all edges to its super. 0 constant
|
||||
- (void)pinToSuperView;
|
||||
|
||||
// Add a view to be constrained in this view.
|
||||
- (void)addConstrainedView:(nonnull UIView *)view;
|
||||
|
||||
// Resets all the constraints to default.
|
||||
- (void)resetConstraints;
|
||||
|
||||
|
||||
@ -22,6 +22,6 @@ import Foundation
|
||||
// The Field name key value pair for sending to server
|
||||
@objc optional func formFieldName() -> String?
|
||||
|
||||
// The Feild value key value paid for sending to server
|
||||
@objc optional func formFieldValue() -> String?
|
||||
// The Feild value key value pair for sending to server
|
||||
@objc optional func formFieldValue() -> Any?
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user