From 709277362f6a5a7bc6076d2b6a49a8674a95484e Mon Sep 17 00:00:00 2001 From: "Murugan, Vimal" Date: Fri, 3 Jan 2020 20:20:23 +0530 Subject: [PATCH] updated constraints --- MVMCoreUI/Molecules/BulletList.swift | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Molecules/BulletList.swift b/MVMCoreUI/Molecules/BulletList.swift index 5cb0dbd4..e5eab994 100644 --- a/MVMCoreUI/Molecules/BulletList.swift +++ b/MVMCoreUI/Molecules/BulletList.swift @@ -92,12 +92,12 @@ open class BulletList: Container { // Adds the molecules and sets the json. for (index, map) in list.enumerated() { if let item = items?[index] { - item.leftText = bulletChar + item.leftText = bulletChar ?? String(index+1) item.setWithJSON(map, delegateObject: delegateObject, additionalData: nil) addView(item, lastItem: index == list.count - 1) } else { let leftLabel = LeftLabelRightMoleculeContainer() - leftLabel.leftText = bulletChar + leftLabel.leftText = bulletChar ?? String(index+1) leftLabel.setWithJSON(map, delegateObject: delegateObject, additionalData: additionalData) addView(leftLabel, lastItem: index == list.count - 1) } @@ -214,9 +214,16 @@ class LeftLabelRightMoleculeContainer: View { addSubview(rightContainer) addSubview(leftContainer) leftContainer.addSubview(label) - //NSLayoutConstraint.constraintPinSubview(toSuperview: label) + NSLayoutConstraint.constraintPinSubview(label, pinTop: true, pinBottom: false, pinLeft: true, pinRight: false) - leftContainer.leftAnchor.constraint(greaterThanOrEqualTo: label.rightAnchor).isActive = true + label.rightAnchor.constraint(greaterThanOrEqualTo: leftContainer.leftAnchor).isActive = true + let labelRightAnchor = label.rightAnchor.constraint(equalTo: leftContainer.leftAnchor) + labelRightAnchor.priority = UILayoutPriority(rawValue: 200) + labelRightAnchor.isActive = true + leftContainer.bottomAnchor.constraint(greaterThanOrEqualTo: label.bottomAnchor).isActive = true + let labelBotAnchor = leftContainer.bottomAnchor.constraint(equalTo: label.bottomAnchor) + labelBotAnchor.priority = UILayoutPriority(rawValue: 200) + labelBotAnchor.isActive = true NSLayoutConstraint.constraintPinSubview(leftContainer, pinTop: true, pinBottom: false, pinLeft: true, pinRight: false) bottomAnchor.constraint(greaterThanOrEqualTo: leftContainer.bottomAnchor).isActive = true