Compare commits

...

2 Commits

Author SHA1 Message Date
Arnaud Dorgans fcea3c29e7 bump 2018-08-12 14:58:45 +02:00
Arnaud Dorgans 7eb29bd82a fix scroll to index 2018-08-12 14:58:27 +02:00
2 changed files with 15 additions and 1 deletions
+1 -1
View File
@@ -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)