UIScrollView scrollViewDidEndDecelerating does not fire
I have UIScrollView
one created programmatically inside UIView
. What do I need to do to make sure I can use the delegate method scrollViewDidEndDecelerating
?
This is what I installed, suppose UIScrollView
there are three UIImageViews
. When the first page loads, I look at the center UIImageView
and I can scroll back once or forward once. The reason I need this delegate method is because I intend to use it to calculate which one UIImageView
I am currently looking at.
ViewController.h
@interface ViewController : UIViewController <UIScrollViewDelegate>
ViewController.m
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:self.view.bounds];
scrollView.pagingEnabled = YES;
[self.view addSubview: scrollView];
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
NSLog(@"scrollViewDidEndDecelerating");
}
source to share