Reputation: 16730
I see others questions on StackOverflow saying that i need to make sure that the paging is set to off. But I have done this and still it is not called.
Is there any thing i am missing?
Here is the sample project on Github. There is no code in it at all except the code to setup a collection view.
here is the code:
func collectionView(collectionView: UICollectionView, targetContentOffsetForProposedContentOffset proposedContentOffset: CGPoint) -> CGPoint {
return proposedContentOffset
}
Upvotes: 1
Views: 1766
Reputation: 2825
You might be thinking of targetContentOffset(forProposedContentOffset:withScrollingVelocity:)
override func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint, withScrollingVelocity velocity: CGPoint) -> CGPoint {
var contentOffset = proposedContentOffset
// do something with contentOffset
return contentOffset
}
with isPagingEnabled
set to false on the collection view.
Upvotes: 5
Reputation: 183
As stated in Apple docs,
The proposed point (in the coordinate space of the collection view’s content view) for the upper-left corner of the visible content. This represents the point that the collection view has calculated as the most likely value to use for the animations or layout update.
In other words, it's called when you delete or insert cells to collection view.
Upvotes: 6