fixed issues with TileContainer
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
5d6bba44ba
commit
c7393aee84
@ -187,29 +187,40 @@ open class TileContainer: Control {
|
|||||||
/// 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()
|
||||||
|
|
||||||
|
let layoutGuide = UILayoutGuide()
|
||||||
|
addLayoutGuide(layoutGuide)
|
||||||
|
layoutGuide
|
||||||
|
.pinTop()
|
||||||
|
.pinLeading()
|
||||||
|
.pinTrailing(0, .defaultHigh)
|
||||||
|
.pinBottom(0, .defaultHigh)
|
||||||
|
|
||||||
addSubview(backgroundImageView)
|
addSubview(backgroundImageView)
|
||||||
addSubview(containerView)
|
addSubview(containerView)
|
||||||
addSubview(highlightView)
|
addSubview(highlightView)
|
||||||
|
|
||||||
widthConstraint = widthAnchor.constraint(equalToConstant: 0)
|
widthConstraint = layoutGuide.widthAnchor.constraint(equalToConstant: 0)
|
||||||
|
widthConstraint?.priority = .defaultHigh
|
||||||
|
|
||||||
heightGreaterThanConstraint = heightAnchor.constraint(greaterThanOrEqualToConstant: 44.0)
|
heightGreaterThanConstraint = layoutGuide.heightAnchor.constraint(greaterThanOrEqualToConstant: 44.0)
|
||||||
heightGreaterThanConstraint?.isActive = false
|
heightGreaterThanConstraint?.isActive = false
|
||||||
|
|
||||||
heightConstraint = heightAnchor.constraint(equalToConstant: 0)
|
heightConstraint = layoutGuide.heightAnchor.constraint(equalToConstant: 0)
|
||||||
|
heightConstraint?.priority = .defaultHigh
|
||||||
backgroundImageView.pinToSuperView()
|
|
||||||
|
backgroundImageView.pin(layoutGuide)
|
||||||
backgroundImageView.isUserInteractionEnabled = false
|
backgroundImageView.isUserInteractionEnabled = false
|
||||||
backgroundImageView.isHidden = true
|
backgroundImageView.isHidden = true
|
||||||
|
|
||||||
containerView.backgroundColor = .clear
|
containerView.backgroundColor = .clear
|
||||||
|
|
||||||
containerTopConstraint = containerView.pinTop(anchor: topAnchor, constant: padding.value)
|
containerTopConstraint = containerView.pinTop(anchor: layoutGuide.topAnchor, constant: padding.value)
|
||||||
containerBottomConstraint = containerView.pinBottom(anchor: bottomAnchor, constant: padding.value)
|
containerBottomConstraint = containerView.pinBottom(anchor: layoutGuide.bottomAnchor, constant: padding.value)
|
||||||
containerLeadingConstraint = containerView.pinLeading(anchor: leadingAnchor, constant: padding.value)
|
containerLeadingConstraint = containerView.pinLeading(anchor: layoutGuide.leadingAnchor, constant: padding.value)
|
||||||
containerTrailingConstraint = containerView.pinTrailing(anchor: trailingAnchor, constant: padding.value)
|
containerTrailingConstraint = containerView.pinTrailing(anchor: layoutGuide.trailingAnchor, constant: padding.value)
|
||||||
|
|
||||||
highlightView.pinToSuperView()
|
highlightView.pin(layoutGuide)
|
||||||
highlightView.isHidden = true
|
highlightView.isHidden = true
|
||||||
highlightView.backgroundColor = .clear
|
highlightView.backgroundColor = .clear
|
||||||
|
|
||||||
|
|||||||
@ -31,19 +31,19 @@ extension LayoutConstraintable {
|
|||||||
@discardableResult
|
@discardableResult
|
||||||
/// Pins each to the all 4 anchor points to a view.
|
/// Pins each to the all 4 anchor points to a view.
|
||||||
/// - Parameters:
|
/// - Parameters:
|
||||||
/// - view: View that you will be pinned within.
|
/// - layoutConstrainable: LayoutConstrainable that you will be pinned within.
|
||||||
/// - edges: Insets for each side.
|
/// - edges: Insets for each side.
|
||||||
/// - Returns: Yourself.
|
/// - Returns: Yourself.
|
||||||
public func pin(_ view: UIView, with edges: UIEdgeInsets = UIEdgeInsets.zero) -> Self {
|
public func pin(_ layoutConstrainable: LayoutConstraintable, with edges: UIEdgeInsets = UIEdgeInsets.zero) -> Self {
|
||||||
pinLeading(view.leadingAnchor, edges.left)
|
pinLeading(layoutConstrainable.leadingAnchor, edges.left)
|
||||||
pinTrailing(view.trailingAnchor, edges.right)
|
pinTrailing(layoutConstrainable.trailingAnchor, edges.right)
|
||||||
pinTop(view.topAnchor, edges.top)
|
pinTop(layoutConstrainable.topAnchor, edges.top)
|
||||||
pinBottom(view.bottomAnchor, edges.bottom)
|
pinBottom(layoutConstrainable.bottomAnchor, edges.bottom)
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@discardableResult
|
@discardableResult
|
||||||
|
|
||||||
/// Pins each to the all 4 anchor points to the view you are set within.
|
/// Pins each to the all 4 anchor points to the view you are set within.
|
||||||
/// - Parameter edges: Insets for each side.
|
/// - Parameter edges: Insets for each side.
|
||||||
/// - Returns: Yourself.
|
/// - Returns: Yourself.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user