Added contenthuggingpriority to avoid overlapping of labels.
This commit is contained in:
parent
7702b24d4a
commit
daeece0bbe
@ -13,6 +13,7 @@ import Foundation
|
||||
let rightLabel = Label.commonLabelB2(true)
|
||||
let rightSubLabel = Label.commonLabelB2(true)
|
||||
let containerView = View()
|
||||
let spaceBetweenleftLabelAndRightlabel: CGFloat = 40.0
|
||||
|
||||
// MARK: - MFViewProtocol
|
||||
open override func updateView(_ size: CGFloat) {
|
||||
@ -40,9 +41,14 @@ import Foundation
|
||||
//leftLabel constraints
|
||||
leftLabel.leadingAnchor.constraint(equalTo: containerView.leadingAnchor).isActive = true
|
||||
leftLabel.centerYAnchor.constraint(equalTo: rightLabel.centerYAnchor).isActive = true
|
||||
leftLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 901), for: .horizontal)
|
||||
leftLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 901), for: .horizontal)
|
||||
//rightLabel constraints
|
||||
rightLabel.leadingAnchor.constraint(greaterThanOrEqualTo: leftLabel.trailingAnchor, constant: spaceBetweenleftLabelAndRightlabel).isActive = true
|
||||
rightLabel.topAnchor.constraint(equalTo: containerView.topAnchor).isActive = true
|
||||
rightLabel.trailingAnchor.constraint(equalTo: containerView.trailingAnchor).isActive = true
|
||||
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 902), for: .horizontal)
|
||||
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 902), for: .horizontal)
|
||||
//rightSubLabel constraints
|
||||
rightSubLabel.topAnchor.constraint(equalTo: rightLabel.bottomAnchor).isActive = true
|
||||
rightSubLabel.trailingAnchor.constraint(equalTo: containerView.trailingAnchor).isActive = true
|
||||
|
||||
Loading…
Reference in New Issue
Block a user