fixed bug in radiobox

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-08-12 12:27:49 -05:00
parent 307ac909a8
commit 3ee592f638

View File

@ -67,17 +67,26 @@ open class RadioBoxGroup: SelectorGroupBase<RadioBoxItem>, SelectorGroupSingleSe
// MARK: - Overrides
//--------------------------------------------------
private func ensureDevice() {
var axis: NSLayoutConstraint.Axis = .vertical
var distribution: UIStackView.Distribution = .fill
defer {
mainStackView.axis = axis
mainStackView.distribution = distribution
}
if UIDevice.isIPad {
mainStackView.axis = .horizontal
mainStackView.distribution = .fillEqually
axis = .horizontal
distribution = .fillEqually
} else {
guard let supportedOrientations = UIApplication.shared.windows.first?.rootViewController?.supportedInterfaceOrientations else {
return
}
let orientation = UIDevice.current.orientation
if orientation == .landscapeLeft || orientation == .landscapeRight {
mainStackView.axis = .horizontal
mainStackView.distribution = .fillEqually
} else {
mainStackView.axis = .vertical
mainStackView.distribution = .fill
if supportedOrientations.contains(.landscape) && (orientation == .landscapeLeft || orientation == .landscapeRight) {
axis = .horizontal
distribution = .fillEqually
}
}
}