Detect when a UITextView has finished scrolling

iphone, uitextview

Solution

`UITextView` is a subclass of `UIScrollView`, which has a `UIScrollViewDelegate` class for controlling behaviour related to scrolling. One of its methods is `scrollViewDidEndDecelerating`. You can make your view controller implement this protocol, set your `UITextView`'s `delegate` property to the view controller, and then implement the `scrollViewDidEndDecelerating` method. When the method is called, the `UITextView` will have finished scrolling. e.g.:

in .h:

@interface MyViewController : UIViewController <UIScrollViewDelegate>

in .m:

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
    NSLog(@"Finished scrolling");
}

Problem

Is there a way to detect when a UITextView has finished scrolling? As a note, I allow the user to enable or disable paging. Thanks.

Original source