Is there a way to deactivate the decelerating of a UIScrollView?
I want to allow the user to scroll the canvas, but I don't want that the canvas continues scrolling after the user lifted the finger.
cocoa-touchiphoneiphone-sdk-3.0uiscrollview
Is there a way to deactivate the decelerating of a UIScrollView?
I want to allow the user to scroll the canvas, but I don't want that the canvas continues scrolling after the user lifted the finger.
Best Answer
This can be done by utilizing the
UIScrollView
delegate methodscrollViewWillBeginDecelerating
to automatically set the content offset to the current screen position.To implement:
UIScrollView
object if you have not already done so.In your delegate's
.m
implementation file, add the following lines of code:Voila! No more auto-scroll.