fixed bugs

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2022-11-18 14:24:47 -06:00
parent c73c3496fc
commit 2343b57e67
2 changed files with 2 additions and 11 deletions

View File

@ -87,7 +87,6 @@ open class ButtonGroup: View, UICollectionViewDataSource, UICollectionViewDelega
}
}
//--------------------------------------------------
// MARK: - Initializers
//--------------------------------------------------
@ -148,7 +147,6 @@ open class ButtonGroup: View, UICollectionViewDataSource, UICollectionViewDelega
let button = buttons[indexPath.row]
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "collectionViewCell", for: indexPath)
cell.subviews.forEach { $0.removeFromSuperview() }
cell.subviews.forEach { $0.removeFromSuperview() }
cell.addSubview(button)
button.pinToSuperView()
return cell

View File

@ -68,7 +68,8 @@ class ButtonGroupPositionLayout: UICollectionViewLayout {
super.prepare()
itemCache.removeAll()
layoutHeight = 0.0
guard let collectionView = collectionView else {
return
}
@ -129,8 +130,6 @@ class ButtonGroupPositionLayout: UICollectionViewLayout {
}
override func layoutAttributesForElements(in rect: CGRect)-> [UICollectionViewLayoutAttributes]? {
super.layoutAttributesForElements(in: rect)
var visibleLayoutAttributes: [UICollectionViewLayoutAttributes] = []
for attributes in itemCache {
@ -143,7 +142,6 @@ class ButtonGroupPositionLayout: UICollectionViewLayout {
}
override func layoutAttributesForItem(at indexPath: IndexPath) -> UICollectionViewLayoutAttributes? {
super.layoutAttributesForItem(at: indexPath)
return itemCache[indexPath.row]
}
@ -158,10 +156,5 @@ class ButtonGroupPositionLayout: UICollectionViewLayout {
let insets = collectionView.contentInset
return collectionView.bounds.width - (insets.left + insets.right)
}
override func shouldInvalidateLayout(forBoundsChange newBounds: CGRect) -> Bool {
layoutHeight = 0.0
return true
}
}