ensure any buttonBase in ButtonGroup is 1 line only

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-12-15 13:04:46 -06:00
parent 57db5768ef
commit 94a505d20e

View File

@ -149,7 +149,15 @@ open class ButtonGroup: View {
case .percentage(let value): percentage = value
}
}
buttons.forEach { if let width { ($0 as? Button)?.width = .value(width) } }
buttons.forEach { buttonBase in
//only allow 1 line for any button
buttonBase.titleLabel?.numberOfLines = 1
buttonBase.titleLabel?.lineBreakMode = .byTruncatingTail
if let width {
(buttonBase as? Button)?.width = .value(width)
}
}
positionLayout.buttonPercentage = percentage
collectionView.reloadData()