UIScrollViewDelegate scrollViewWillEndDragging: withVelocity: targetContentOffset called with pagingEnabled = YES

According to Apple's documentation (and many other places) UIScrollViewDelegate: scrollViewWillEndDragging: withVelocity: targetContentOffset is not called if UIScrollView.pagingEnabled is set to YES. However, on iOS6 this seems to be true, however on iOS7 it ALWAYS gets called for me, no matter what pagingEnabled is installed.

Here is a simple test view controller:

@interface ViewController () <UIScrollViewDelegate> @property (weak, nonatomic) IBOutlet UIWebView *webView; @end @implementation ViewController - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset { NSLog(@"%d", scrollView.pagingEnabled); } - (void)viewDidLoad { [super viewDidLoad]; [self loadHTML]; [self configureWebView]; } - (void)loadHTML { NSString* htmlPath = [[NSBundle mainBundle] pathForResource:@"htmlContent" ofType:@"html"]; NSString* htmlString = [NSString stringWithContentsOfFile:htmlPath encoding:NSUTF8StringEncoding error:nil]; [_webView loadHTMLString:htmlString baseURL:nil]; } - (void)configureWebView { [_webView.scrollView setDelegate:self]; _webView.scrollView.pagingEnabled = YES; } @end 

In iOS7, if pagingEnabled == YES, the NSLog in scrollViewWillEndDragging prints 1, if it is set to NO, it prints 0.

In iOS6, when pagingEnabled == YES, console output:

 Stop offset can not be modified for paging scroll views 

When it is NOT, the output is 0.

Does anyone else understand this? Does anyone know if this will be the case in iOS7? The documentation has not changed, so I suppose not, but I thought I would ask you all to submit an error report with Apple and add checks for pagingEnabled in all my delegated calls.

+8
ios objective-c uiscrollview uiscrollviewdelegate
source share

No one has answered this question yet.

See related questions:

928
How do I call Objective-C code from Swift?
thirteen
What is a unit of speed in scrollViewWillEndDragging: withVelocity: targetContentOffset :?
5
How to add Highcharts to UIWebView in iOS?
3
Click on ScrollView to call `scrollViewWillBeginDecelerating` when scrollView is set to pagingEnabled for YES
one
Removing MKMapView annotations causes leak
0
How to override UIScrollView swap using UIScrollViewDelegate methods
0
Unused UIScrollViewDelegate Methods
0
Subclassification of UIScrollView / UIScrollViewDelegate
0
UIScrollViewDelegate does not scroll animated
0
Why can't I remove my annotations from mapview?

All Articles