You would implement UIScrollViewDelegate
protocol method as follows:
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
if (!decelerate) {
[self scrollingFinish];
}
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
[self scrollingFinish];
}
- (void)scrollingFinish {
//enter code here
}
Swift version
public func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
if decelerate {
scrollingFinished()
}
}
public func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
scrollingFinished()
}
func scrollingFinished() {
print("scrolling finished...")
}
For the above delegate method The scroll view sends this message when the user’s finger touches up after dragging content. The decelerating property of UIScrollView controls deceleration.
When the view decelerated to stop, the parameter decelerate
will be NO
.
Second one used for scrolling slowly, even scrolling stop when your finger touch up, as Apple Documents said, when the scrolling movement comes to a halt
.