Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bcc954d105 | |||
| 543b75cf56 | |||
| 4bd0209ccb | |||
| 6fcd6a52e2 |
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "InfiniteCollectionView"
|
||||
s.version = "1.2.1"
|
||||
s.version = "1.3.0"
|
||||
s.summary = "Infinite Scrolling Using UICollectionView."
|
||||
s.homepage = "https://github.com/hryk224/InfiniteCollectionView"
|
||||
s.screenshots = "https://github.com/hryk224/InfiniteCollectionView/wiki/images/sample1.gif"
|
||||
|
||||
@@ -50,6 +50,28 @@ open class InfiniteCollectionView: UICollectionView {
|
||||
open func rotate(_ notification: Notification) {
|
||||
setContentOffset(CGPoint(x: CGFloat(pageIndex + indexOffset) * itemWidth, y: contentOffset.y), animated: false)
|
||||
}
|
||||
|
||||
open override func selectItem(at indexPath: IndexPath?, animated: Bool, scrollPosition: UICollectionViewScrollPosition) {
|
||||
|
||||
// Correct the input IndexPath
|
||||
let correctedIndexPath = IndexPath(row: correctedIndex(indexPath!.item + indexOffset), section: 0);
|
||||
|
||||
// Get the currently visible cell(s) - assumes a cell is visible
|
||||
guard let visibleCell = self.visibleCells.first else{
|
||||
return; // Nothing to select...
|
||||
}
|
||||
// Index path of the cell - does not consider multiple cells on the screen at the same time
|
||||
var visibleIndexPath : IndexPath! = self.indexPath(for: visibleCell);
|
||||
|
||||
let testIndexPath = IndexPath(row: correctedIndex(visibleIndexPath!.item), section: 0);
|
||||
|
||||
guard correctedIndexPath != testIndexPath else{
|
||||
return; // Do not re-select the same cell
|
||||
}
|
||||
|
||||
// Call supercase to select the correct IndexPath
|
||||
super.selectItem(at: correctedIndexPath, animated: animated, scrollPosition: scrollPosition);
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - private
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.2.1</string>
|
||||
<string>1.3.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
Reference in New Issue
Block a user