updated constraints

This commit is contained in:
Murugan, Vimal 2020-01-03 20:20:23 +05:30
parent dd49c43946
commit 709277362f

View File

@ -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