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()
|
super.setup()
|
||||||
addSubview(collectionView)
|
addSubview(collectionView)
|
||||||
collectionView.pinToSuperView()
|
collectionView.pinToSuperView()
|
||||||
|
backgroundColor = .red
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -150,11 +151,11 @@ open class ButtonGroup: View, UICollectionViewDataSource, UICollectionViewDelega
|
|||||||
|
|
||||||
open override func layoutSubviews() {
|
open override func layoutSubviews() {
|
||||||
super.layoutSubviews()
|
super.layoutSubviews()
|
||||||
// // Accounts for any collection size changes
|
// Accounts for any collection size changes
|
||||||
// DispatchQueue.main.async { [weak self] in
|
DispatchQueue.main.async { [weak self] in
|
||||||
// guard let self else { return }
|
guard let self else { return }
|
||||||
// self.collectionView.collectionViewLayout.invalidateLayout()
|
self.collectionView.collectionViewLayout.invalidateLayout()
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -197,5 +198,7 @@ open class ButtonGroup: View, UICollectionViewDataSource, UICollectionViewDelega
|
|||||||
public func collectionView(_ collectionView: UICollectionView, buttonableAtIndexPath indexPath: IndexPath) -> Buttonable {
|
public func collectionView(_ collectionView: UICollectionView, buttonableAtIndexPath indexPath: IndexPath) -> Buttonable {
|
||||||
buttons[indexPath.row]
|
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)
|
super.init(coder: coder)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var line = UIView().with {
|
|
||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Functions
|
// MARK: - Public Functions
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -76,13 +72,6 @@ open class TextLink: ButtonBase {
|
|||||||
isAccessibilityElement = true
|
isAccessibilityElement = true
|
||||||
accessibilityTraits = .link
|
accessibilityTraits = .link
|
||||||
if let titleLabel {
|
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)
|
titleLabel.debugBorder(show: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,13 +96,8 @@ open class TextLink: ButtonBase {
|
|||||||
return titleLabel?.intrinsicContentSize ?? super.intrinsicContentSize
|
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 layoutSubviews() {
|
||||||
open override func updateView() {
|
super.layoutSubviews()
|
||||||
//need to set the properties so the super class
|
addBorder(side: .bottom, width: 1, color: textColor)
|
||||||
//can render out the label correctly
|
|
||||||
line.backgroundColor = textColor
|
|
||||||
|
|
||||||
//always call last so the label is rendered
|
|
||||||
super.updateView()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user