Fixes misaligned ControllerInputsViewController callout views on iOS 14.5
This commit is contained in:
parent
c3c6fb32cc
commit
4ed4b8ba06
@ -50,6 +50,8 @@ class GridCollectionViewLayout: UICollectionViewFlowLayout
|
|||||||
return interitemSpacing
|
return interitemSpacing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var cachedLayoutAttributes = [IndexPath: UICollectionViewLayoutAttributes]()
|
||||||
|
|
||||||
override var estimatedItemSize: CGSize {
|
override var estimatedItemSize: CGSize {
|
||||||
didSet {
|
didSet {
|
||||||
fatalError("GridCollectionViewLayout does not support self-sizing cells.")
|
fatalError("GridCollectionViewLayout does not support self-sizing cells.")
|
||||||
@ -137,9 +139,24 @@ class GridCollectionViewLayout: UICollectionViewFlowLayout
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for attributes in layoutAttributes
|
||||||
|
{
|
||||||
|
// Update cached attributes for layoutAttributesForItem(at:)
|
||||||
|
self.cachedLayoutAttributes[attributes.indexPath] = attributes
|
||||||
|
}
|
||||||
|
|
||||||
return layoutAttributes
|
return layoutAttributes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func layoutAttributesForItem(at indexPath: IndexPath) -> UICollectionViewLayoutAttributes?
|
||||||
|
{
|
||||||
|
if let cachedAttributes = self.cachedLayoutAttributes[indexPath]
|
||||||
|
{
|
||||||
|
return cachedAttributes
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.layoutAttributesForItem(at: indexPath)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private extension GridCollectionViewLayout
|
private extension GridCollectionViewLayout
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user