From 3cb075499e83135cbb790785041a340b308bb0ae Mon Sep 17 00:00:00 2001 From: panxi Date: Tue, 19 Nov 2019 10:39:30 -0500 Subject: [PATCH 1/3] make checkbox expandable --- MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.m b/MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.m index 50377b1a..3f74a3ee 100644 --- a/MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.m +++ b/MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.m @@ -228,7 +228,9 @@ static const CGFloat CheckBoxHeightWidth = 18.0; NSDictionary *constraints = [NSLayoutConstraint constraintPinView:checkedSquare heightConstraint:YES heightConstant:size widthConstraint:YES widthConstant:size]; self.checkboxWidth = constraints[ConstraintWidth]; self.checkboxHeight = constraints[ConstraintHeight]; - [NSLayoutConstraint constraintPinSubview:checkedSquare pinTop:YES pinBottom:YES pinLeft:YES pinRight:NO]; + [NSLayoutConstraint constraintPinSubview:checkedSquare pinTop:NO pinBottom:NO pinLeft:YES pinRight:NO]; + [checkedSquare.topAnchor constraintGreaterThanOrEqualToAnchor:containterView.topAnchor].active = YES; + [containterView.bottomAnchor constraintGreaterThanOrEqualToAnchor:checkedSquare.bottomAnchor].active = YES; self.checkboxRightPinConstraint = [checkedSquare.trailingAnchor constraintEqualToAnchor:containterView.trailingAnchor]; @@ -256,6 +258,8 @@ static const CGFloat CheckBoxHeightWidth = 18.0; [containterView addSubview:descriptionLabel]; [NSLayoutConstraint constraintPinSubview:descriptionLabel pinCenterX:NO pinCenterY:YES]; [NSLayoutConstraint constraintPinSubview:descriptionLabel pinTop:NO pinBottom:NO pinLeft:NO pinRight:YES]; + [descriptionLabel.topAnchor constraintGreaterThanOrEqualToAnchor:containterView.topAnchor].active = YES; + [containterView.bottomAnchor constraintGreaterThanOrEqualToAnchor:descriptionLabel.bottomAnchor].active = YES; self.descriptionLabelLeadingConstraint = [NSLayoutConstraint constraintWithItem:descriptionLabel attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self.checkedSquare attribute:NSLayoutAttributeTrailing multiplier:1 constant:11]; self.descriptionLabelLeadingConstraint.active = YES; From 3851ad036ae63791d5ad6b532f5317abef3e8436 Mon Sep 17 00:00:00 2001 From: panxi Date: Tue, 19 Nov 2019 12:53:48 -0500 Subject: [PATCH 2/3] change to equal --- MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.m b/MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.m index 3f74a3ee..6a9d7fff 100644 --- a/MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.m +++ b/MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.m @@ -258,8 +258,8 @@ static const CGFloat CheckBoxHeightWidth = 18.0; [containterView addSubview:descriptionLabel]; [NSLayoutConstraint constraintPinSubview:descriptionLabel pinCenterX:NO pinCenterY:YES]; [NSLayoutConstraint constraintPinSubview:descriptionLabel pinTop:NO pinBottom:NO pinLeft:NO pinRight:YES]; - [descriptionLabel.topAnchor constraintGreaterThanOrEqualToAnchor:containterView.topAnchor].active = YES; - [containterView.bottomAnchor constraintGreaterThanOrEqualToAnchor:descriptionLabel.bottomAnchor].active = YES; + [descriptionLabel.topAnchor constraintEqualToAnchor:containterView.topAnchor].active = YES; + [containterView.bottomAnchor constraintEqualToAnchor:descriptionLabel.bottomAnchor].active = YES; self.descriptionLabelLeadingConstraint = [NSLayoutConstraint constraintWithItem:descriptionLabel attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self.checkedSquare attribute:NSLayoutAttributeTrailing multiplier:1 constant:11]; self.descriptionLabelLeadingConstraint.active = YES; From a409b331c52a8b3269264bab02cceb666b5c8143 Mon Sep 17 00:00:00 2001 From: panxi Date: Tue, 19 Nov 2019 12:56:07 -0500 Subject: [PATCH 3/3] revert --- MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.m | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.m b/MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.m index 6a9d7fff..54358ebe 100644 --- a/MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.m +++ b/MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.m @@ -257,9 +257,7 @@ static const CGFloat CheckBoxHeightWidth = 18.0; Label *descriptionLabel = [Label commonLabelB2:YES]; [containterView addSubview:descriptionLabel]; [NSLayoutConstraint constraintPinSubview:descriptionLabel pinCenterX:NO pinCenterY:YES]; - [NSLayoutConstraint constraintPinSubview:descriptionLabel pinTop:NO pinBottom:NO pinLeft:NO pinRight:YES]; - [descriptionLabel.topAnchor constraintEqualToAnchor:containterView.topAnchor].active = YES; - [containterView.bottomAnchor constraintEqualToAnchor:descriptionLabel.bottomAnchor].active = YES; + [NSLayoutConstraint constraintPinSubview:descriptionLabel pinTop:YES pinBottom:YES pinLeft:NO pinRight:YES]; self.descriptionLabelLeadingConstraint = [NSLayoutConstraint constraintWithItem:descriptionLabel attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self.checkedSquare attribute:NSLayoutAttributeTrailing multiplier:1 constant:11]; self.descriptionLabelLeadingConstraint.active = YES;