S
Size: a a a
S
АК
АК
S
AB
А
А
B
M
А
B
А
B
А
orientation = size.getOrientation()
guard orientation != .undefined
else {
return }
let ratio = size.getWidthRatio()
var width: CGFloat
var height: CGFloat
switch orientation {
case .landscape:
width = size.width
if width > maxWidth {
width = maxWidth
}
else
if width < 100 {
width = 100
}
height = width * ratio
if height < 100 {
height = 100
}
case .portrait:
height = size.height
if height > maxHeight {
height = maxHeight
}
else
if height < 100 {
height = 100
}
width = height / ratio
if width < 100 {
width = 100
}
default:
width = 100.0
height = 100.0
}
widthConstarint.constant = width
heightConstraint.constant = height
А
А
B
А
А