updating to fix for height
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
76454b2771
commit
a340598861
@ -55,6 +55,7 @@ open class TileContainer: Control {
|
||||
case ratio16x9 = "16:9"
|
||||
case ratio1x2 = "1:2"
|
||||
case ratio2x1 = "2:1"
|
||||
case none
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -120,6 +121,7 @@ open class TileContainer: Control {
|
||||
//--------------------------------------------------
|
||||
internal var widthConstraint: NSLayoutConstraint?
|
||||
internal var heightConstraint: NSLayoutConstraint?
|
||||
internal var heightGreaterThanConstraint: NSLayoutConstraint?
|
||||
internal var containerTopConstraint: NSLayoutConstraint?
|
||||
internal var containerBottomConstraint: NSLayoutConstraint?
|
||||
internal var containerLeadingConstraint: NSLayoutConstraint?
|
||||
@ -138,7 +140,10 @@ open class TileContainer: Control {
|
||||
|
||||
widthConstraint = widthAnchor.constraint(equalToConstant: width)
|
||||
widthConstraint?.isActive = true
|
||||
|
||||
|
||||
heightGreaterThanConstraint = heightAnchor.constraint(greaterThanOrEqualToConstant: 44.0)
|
||||
heightGreaterThanConstraint?.isActive = false
|
||||
|
||||
heightConstraint = heightAnchor.constraint(equalToConstant: width)
|
||||
heightConstraint?.isActive = true
|
||||
|
||||
@ -222,6 +227,9 @@ open class TileContainer: Control {
|
||||
height = (2 / 1) * width
|
||||
case .ratio2x1:
|
||||
height = (1 / 2) * width
|
||||
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
return CGSize(width: width, height: height)
|
||||
@ -250,13 +258,21 @@ open class TileContainer: Control {
|
||||
containerBottomConstraint?.constant = -padding
|
||||
containerTrailingConstraint?.constant = -padding
|
||||
|
||||
if let height {
|
||||
if aspectRatio == .none {
|
||||
widthConstraint?.constant = width
|
||||
heightConstraint?.isActive = false
|
||||
heightGreaterThanConstraint?.isActive = true
|
||||
} else if let height {
|
||||
widthConstraint?.constant = width
|
||||
heightConstraint?.constant = height
|
||||
heightConstraint?.isActive = true
|
||||
heightGreaterThanConstraint?.isActive = false
|
||||
} else {
|
||||
let size = ratioSize
|
||||
widthConstraint?.constant = size.width
|
||||
heightConstraint?.constant = size.height
|
||||
heightConstraint?.isActive = true
|
||||
heightGreaterThanConstraint?.isActive = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -98,6 +98,7 @@ open class Tilet: TileContainer {
|
||||
|
||||
open override func setup() {
|
||||
super.setup()
|
||||
aspectRatio = .none
|
||||
surface = .light
|
||||
addContentView(titleLockup)
|
||||
contentViewWithConstraint = titleLockup.widthAnchor.constraint(equalToConstant: width - (padding * 2))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user