Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fcea3c29e7 | |||
| 7eb29bd82a |
@@ -8,7 +8,7 @@
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'InfiniteLayout'
|
||||
s.version = '0.2.3.2'
|
||||
s.version = '0.2.3.3'
|
||||
s.summary = 'Horizontal and Vertical infinite scrolling feature for UICollectionView with Paging, NSProxy delegate, Reactive extension'
|
||||
|
||||
# This description is used to generate tags and improve search results.
|
||||
|
||||
@@ -16,6 +16,13 @@ open class InfiniteLayout: UICollectionViewFlowLayout {
|
||||
private var contentSize: CGSize = .zero
|
||||
|
||||
private (set) var isEnabled: Bool = false
|
||||
|
||||
public var currentPage: CGPoint {
|
||||
guard let collectionView = self.collectionView else {
|
||||
return .zero
|
||||
}
|
||||
return self.page(for: collectionView.contentOffset)
|
||||
}
|
||||
|
||||
open override func shouldInvalidateLayout(forBoundsChange newBounds: CGRect) -> Bool {
|
||||
return true
|
||||
@@ -60,6 +67,13 @@ open class InfiniteLayout: UICollectionViewFlowLayout {
|
||||
height: scrollDirection == .vertical ? self.contentSize.height * multiplier : self.contentSize.height)
|
||||
}
|
||||
|
||||
open override func layoutAttributesForItem(at indexPath: IndexPath) -> UICollectionViewLayoutAttributes? {
|
||||
guard let attributes = super.layoutAttributesForItem(at: indexPath) else {
|
||||
return nil
|
||||
}
|
||||
return self.layoutAttributes(from: attributes, page: currentPage)
|
||||
}
|
||||
|
||||
override open func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
|
||||
guard isEnabled else {
|
||||
return super.layoutAttributesForElements(in: rect)
|
||||
|
||||
Reference in New Issue
Block a user