removed view and added line
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
28db6509cc
commit
6f7fb965e5
@ -135,6 +135,7 @@ open class ButtonGroup: View, UICollectionViewDataSource, UICollectionViewDelega
|
||||
super.setup()
|
||||
addSubview(collectionView)
|
||||
collectionView.pinToSuperView()
|
||||
backgroundColor = .red
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -150,11 +151,11 @@ open class ButtonGroup: View, UICollectionViewDataSource, UICollectionViewDelega
|
||||
|
||||
open override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
// // Accounts for any collection size changes
|
||||
// DispatchQueue.main.async { [weak self] in
|
||||
// guard let self else { return }
|
||||
// self.collectionView.collectionViewLayout.invalidateLayout()
|
||||
// }
|
||||
// Accounts for any collection size changes
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
guard let self else { return }
|
||||
self.collectionView.collectionViewLayout.invalidateLayout()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -197,5 +198,7 @@ open class ButtonGroup: View, UICollectionViewDataSource, UICollectionViewDelega
|
||||
public func collectionView(_ collectionView: UICollectionView, buttonableAtIndexPath indexPath: IndexPath) -> Buttonable {
|
||||
buttons[indexPath.row]
|
||||
}
|
||||
|
||||
public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
||||
print("index")
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,10 +64,6 @@ open class TextLink: ButtonBase {
|
||||
super.init(coder: coder)
|
||||
}
|
||||
|
||||
private var line = UIView().with {
|
||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Public Functions
|
||||
//--------------------------------------------------
|
||||
@ -76,13 +72,6 @@ open class TextLink: ButtonBase {
|
||||
isAccessibilityElement = true
|
||||
accessibilityTraits = .link
|
||||
if let titleLabel {
|
||||
addSubview(line)
|
||||
line.pinLeading(titleLabel.leadingAnchor)
|
||||
line.pinTrailing(titleLabel.trailingAnchor)
|
||||
line.pinTop(titleLabel.bottomAnchor)
|
||||
line.pinBottom(bottomAnchor)
|
||||
lineHeightConstraint = line.heightAnchor.constraint(equalToConstant: 1.0)
|
||||
lineHeightConstraint?.isActive = true
|
||||
titleLabel.debugBorder(show: true)
|
||||
}
|
||||
}
|
||||
@ -106,14 +95,9 @@ open class TextLink: ButtonBase {
|
||||
open override var intrinsicContentSize: CGSize {
|
||||
return titleLabel?.intrinsicContentSize ?? super.intrinsicContentSize
|
||||
}
|
||||
|
||||
/// Function used to make changes to the View based off a change events or from local properties.
|
||||
open override func updateView() {
|
||||
//need to set the properties so the super class
|
||||
//can render out the label correctly
|
||||
line.backgroundColor = textColor
|
||||
|
||||
//always call last so the label is rendered
|
||||
super.updateView()
|
||||
open override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
addBorder(side: .bottom, width: 1, color: textColor)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user