According to Apples documentation (and numerous other places), UIScrollViewDelegate:scrollViewWillEndDragging:withVelocity:targetContentOffset does not get called if UIScrollView.pagingEnabled is set to YES. On iOS6 this appears to be true, however, on iOS7 it is ALWAYS getting called for me, no matter what pagingEnabled is set to.
Here's 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's set to NO, it prints 0.
In iOS6, when pagingEnabled == YES, console output is:
Stop offset can not be modified for paging scroll views
When it is NO, output is 0.
Is anyone else getting this? Does anyone know if this is supposed to be this way in iOS7? The documentation hasn't changed, so I'm assuming not, but I thought I'd ask you all before filing a bug report with Apple and adding checks for pagingEnabled in all my delegate calls.