This repository was archived by the owner on Jun 17, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -65,10 +65,10 @@ public class CollectionViewPagingLayout: UICollectionViewLayout {
65
65
66
66
67
67
// MARK: UICollectionViewLayout
68
- var ignoreBoundsChange : Bool = false
68
+ var ignoreUpdateCurrentPage : Bool = false
69
69
70
70
override public func shouldInvalidateLayout( forBoundsChange newBounds: CGRect ) -> Bool {
71
- !ignoreBoundsChange
71
+ true
72
72
}
73
73
74
74
override public func layoutAttributesForElements( in rect: CGRect ) -> [ UICollectionViewLayoutAttributes ] ? {
@@ -130,7 +130,9 @@ public class CollectionViewPagingLayout: UICollectionViewLayout {
130
130
131
131
override public func invalidateLayout( ) {
132
132
super. invalidateLayout ( )
133
- updateCurrentPageIfNeeded ( )
133
+ if !ignoreUpdateCurrentPage{
134
+ updateCurrentPageIfNeeded ( )
135
+ }
134
136
}
135
137
136
138
@@ -175,10 +177,10 @@ public class CollectionViewPagingLayout: UICollectionViewLayout {
175
177
offset = max ( 0 , offset)
176
178
offset = min ( offset, maxPossibleOffset)
177
179
let contentOffset : CGPoint = scrollDirection == . horizontal ? CGPoint ( x: offset, y: 0 ) : CGPoint ( x: 0 , y: offset)
178
- ignoreBoundsChange = true
180
+ ignoreUpdateCurrentPage = true
179
181
CATransaction . begin ( )
180
182
CATransaction . setCompletionBlock ( {
181
- self . ignoreBoundsChange = false
183
+ self . ignoreUpdateCurrentPage = false
182
184
self . updateCurrentPageIfNeeded ( basedOn: contentOffset)
183
185
} )
184
186
CATransaction . commit ( )
You can’t perform that action at this time.
0 commit comments