Skip to content

Commit

Permalink
Fix for item offset with cellspacing
Browse files Browse the repository at this point in the history
  • Loading branch information
3ph committed May 22, 2019
1 parent f3bb07c commit a38bf18
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CollectionPickerView/Classes/CollectionPickerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public class CollectionPickerView: UIView {
collectionView,
layout: collectionView.collectionViewLayout,
sizeForItemAt: indexPath)
offset += (isHorizontal ? cellSize.width : cellSize.height)
offset += (isHorizontal ? cellSize.width : cellSize.height) + cellSpacing
}

let selectedIndexPath = IndexPath(item: index, section: 0)
Expand Down Expand Up @@ -423,7 +423,7 @@ extension CollectionPickerView: UICollectionViewDelegateFlowLayout {
}

public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
return cellSpacing
return 0
}

public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ public class CollectionPickerViewFlowLayout: UICollectionViewFlowLayout {
var mostRecentOffset : CGPoint = CGPoint()

public override func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint, withScrollingVelocity velocity: CGPoint) -> CGPoint {
_ = scrollDirection == .horizontal

// _ = scrollDirection == .horizontal
//
// if snapToCenter == false {
// return super.targetContentOffset(forProposedContentOffset: proposedContentOffset, withScrollingVelocity: velocity)
// }
Expand Down

0 comments on commit a38bf18

Please sign in to comment.