Digital ACT-191 ONEAPP-6827 story: container size changes
This commit is contained in:
parent
4c9c844b1d
commit
868c728f63
@ -38,6 +38,11 @@ open class Breadcrumbs: View {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Private Properties
|
||||
//--------------------------------------------------
|
||||
// Sizes are from InVision design specs.
|
||||
internal var containerSize: CGSize { CGSize(width: 45, height: 44) }
|
||||
|
||||
internal var heightConstraint: NSLayoutConstraint?
|
||||
|
||||
let layout: UICollectionViewFlowLayout = LeftAlignedCollectionViewFlowLayout().with {
|
||||
$0.estimatedItemSize = UICollectionViewFlowLayout.automaticSize
|
||||
$0.minimumInteritemSpacing = VDSLayout.Spacing.space1X.value
|
||||
@ -60,12 +65,16 @@ open class Breadcrumbs: View {
|
||||
return collectionView
|
||||
}()
|
||||
|
||||
//--------------------------------------------------
|
||||
//------------------------------------------s--------
|
||||
// MARK: - Overrides
|
||||
//--------------------------------------------------
|
||||
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
||||
open override func setup() {
|
||||
super.setup()
|
||||
//create the wrapping view
|
||||
heightConstraint = self.heightAnchor.constraint(equalToConstant: containerSize.height)
|
||||
heightConstraint?.priority = .defaultHigh
|
||||
heightConstraint?.isActive = true
|
||||
}
|
||||
|
||||
/// Executed on initialization for this View.
|
||||
@ -73,7 +82,6 @@ open class Breadcrumbs: View {
|
||||
super.initialSetup()
|
||||
addSubview(collectionView)
|
||||
collectionView.pinToSuperView()
|
||||
collectionView.heightAnchor.constraint(equalToConstant: 80).activate()
|
||||
}
|
||||
|
||||
/// Resets to default settings.
|
||||
@ -89,6 +97,8 @@ open class Breadcrumbs: View {
|
||||
open override func updateView() {
|
||||
super.updateView()
|
||||
collectionView.reloadData()
|
||||
heightConstraint?.constant = collectionView.collectionViewLayout.collectionViewContentSize.height
|
||||
heightConstraint?.isActive = true
|
||||
}
|
||||
|
||||
open override func layoutSubviews() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user