reverted code back to pin to parent
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
b09731786d
commit
c73c3496fc
@ -18,11 +18,6 @@ public enum BadgeFillColor: String, Codable, CaseIterable {
|
|||||||
@objc(VDSBadge)
|
@objc(VDSBadge)
|
||||||
public class Badge: View, Accessable {
|
public class Badge: View, Accessable {
|
||||||
|
|
||||||
private var contentView = UIView().with {
|
|
||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
|
||||||
$0.layer.cornerRadius = 2
|
|
||||||
}
|
|
||||||
|
|
||||||
private var label = Label().with {
|
private var label = Label().with {
|
||||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||||
$0.adjustsFontSizeToFitWidth = false
|
$0.adjustsFontSizeToFitWidth = false
|
||||||
@ -71,16 +66,7 @@ public class Badge: View, Accessable {
|
|||||||
isAccessibilityElement = true
|
isAccessibilityElement = true
|
||||||
accessibilityTraits = .staticText
|
accessibilityTraits = .staticText
|
||||||
|
|
||||||
contentView.addSubview(label)
|
addSubview(label)
|
||||||
addSubview(contentView)
|
|
||||||
|
|
||||||
contentView
|
|
||||||
.pinTop()
|
|
||||||
.pinBottom()
|
|
||||||
.pinLeading()
|
|
||||||
|
|
||||||
contentView.trailingAnchor.constraint(lessThanOrEqualTo: trailingAnchor).isActive = true
|
|
||||||
|
|
||||||
label.pinToSuperView(.init(top: 2, left: 4, bottom: 2, right: 4))
|
label.pinToSuperView(.init(top: 2, left: 4, bottom: 2, right: 4))
|
||||||
|
|
||||||
maxWidthConstraint = label.widthAnchor.constraint(lessThanOrEqualToConstant: 100)
|
maxWidthConstraint = label.widthAnchor.constraint(lessThanOrEqualToConstant: 100)
|
||||||
@ -188,7 +174,7 @@ public class Badge: View, Accessable {
|
|||||||
// MARK: - State
|
// MARK: - State
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
contentView.backgroundColor = backgroundColor()
|
backgroundColor = backgroundColor()
|
||||||
|
|
||||||
label.textColorConfiguration = textColorConfiguration()
|
label.textColorConfiguration = textColorConfiguration()
|
||||||
label.numberOfLines = numberOfLines
|
label.numberOfLines = numberOfLines
|
||||||
|
|||||||
@ -62,11 +62,6 @@ open class ToggleBase: Control, Accessable, DataTrackable, BinaryColorable {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Properties
|
// MARK: - Private Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private var contentView = UIView().with {
|
|
||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
|
||||||
$0.layer.cornerRadius = 2
|
|
||||||
}
|
|
||||||
|
|
||||||
private var stackView = UIStackView().with {
|
private var stackView = UIStackView().with {
|
||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||||
$0.axis = .horizontal
|
$0.axis = .horizontal
|
||||||
@ -257,15 +252,7 @@ open class ToggleBase: Control, Accessable, DataTrackable, BinaryColorable {
|
|||||||
|
|
||||||
isAccessibilityElement = true
|
isAccessibilityElement = true
|
||||||
accessibilityTraits = .button
|
accessibilityTraits = .button
|
||||||
addSubview(contentView)
|
addSubview(stackView)
|
||||||
contentView.addSubview(stackView)
|
|
||||||
|
|
||||||
contentView
|
|
||||||
.pinTop()
|
|
||||||
.pinBottom()
|
|
||||||
.pinLeading()
|
|
||||||
|
|
||||||
contentView.trailingAnchor.constraint(lessThanOrEqualTo: trailingAnchor).isActive = true
|
|
||||||
|
|
||||||
//set the h/w to container size, since the width "can" grow if text is there
|
//set the h/w to container size, since the width "can" grow if text is there
|
||||||
//allow this to be greaterThanEqualTo
|
//allow this to be greaterThanEqualTo
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user