Skip to content

Instantly share code, notes, and snippets.

@srm
Created November 26, 2012 20:47
Show Gist options
  • Save srm/4150517 to your computer and use it in GitHub Desktop.
Save srm/4150517 to your computer and use it in GitHub Desktop.
Fixing Apple's UIPageViewControllerDatasource mess
-(BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{
if ([gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]){
NSLog(@"Velocity: %f",[(UIPanGestureRecognizer*)gestureRecognizer velocityInView:self.pageViewController.view].x);
if ([(UIPanGestureRecognizer*)gestureRecognizer velocityInView:self.pageViewController.view].x > 0.0) {
return [self isThereAPrevArticle];
}
else if ([(UIPanGestureRecognizer*)gestureRecognizer velocityInView:self.pageViewController.view].x < 0.0) {
return [self isThereANextArticle];
}
}
return YES;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment