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