Collection View Layout - MSPeekCollectionViewDelegateImplementation
MSPeekCollectionViewDelegateImplementation
Cocoa Pod Install
pod 'MSPeekCollectionViewDelegateImplementation
Xcode Example
import MSPeekCollectionViewDelegateImplementation
var behavior : MSCollectionViewPeekingBehavior!
behavior = MSCollectionViewPeekingBehavior(cellSpacing: 0, cellPeekWidth: 0, minimumItemsToScroll: 1, maximumItemsToScroll: 1, numberOfItemsToShow: 1, scrollDirection: .horizontal, velocityThreshold: 0)
collectionView.configureForPeekingBehavior(behavior: behavior)
extension ViewController : UICollectionViewDataSource, UICollectionViewDelegate {
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "CollectionViewCell", for: indexPath) as! CollectionViewCell
cell.imageView.image = UIImage(named: "image")
return cell
}
// scrollViewWillEndDragging : Image View 넘길 때마다 호출되는 함수
func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
behavior.scrollViewWillEndDragging(scrollView, withVelocity: velocity, targetContentOffset: targetContentOffset)
}
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
print(behavior.currentIndex)
}
}
Values
Reference
この問題について(Collection View Layout - MSPeekCollectionViewDelegateImplementation), 我々は、より多くの情報をここで見つけました https://velog.io/@h0neydear/Collection-View-Layout-MSPeekCollectionViewDelegateImplementationテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol