From 3cb075499e83135cbb790785041a340b308bb0ae Mon Sep 17 00:00:00 2001 From: panxi Date: Tue, 19 Nov 2019 10:39:30 -0500 Subject: [PATCH] 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;