left aligned content for scenarios to where the container is stretched.

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-03-18 10:53:42 -05:00
parent 6290a43004
commit 2e0d0be8b6
2 changed files with 9 additions and 0 deletions

View File

@ -87,6 +87,10 @@ open class TextLink: ButtonBase {
isAccessibilityElement = true isAccessibilityElement = true
accessibilityTraits = .link accessibilityTraits = .link
//left align titleLabel in case this is pinned leading/trailing
//default is always set to center
contentHorizontalAlignment = .left
if let titleLabel { if let titleLabel {
addSubview(line) addSubview(line)
line.pinLeading(titleLabel.leadingAnchor) line.pinLeading(titleLabel.leadingAnchor)

View File

@ -79,6 +79,11 @@ open class TextLinkCaret: ButtonBase {
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations. /// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
open override func setup() { open override func setup() {
super.setup() super.setup()
//left align titleLabel in case this is pinned leading/trailing
//default is always set to center
contentHorizontalAlignment = .left
accessibilityTraits = .link accessibilityTraits = .link
titleLabel?.numberOfLines = 0 titleLabel?.numberOfLines = 0
titleLabel?.lineBreakMode = .byWordWrapping titleLabel?.lineBreakMode = .byWordWrapping