Skip to content

Commit

Permalink
Rubber band animation on tap or swipe on first/last page (lift page j…
Browse files Browse the repository at this point in the history
…ust a little and then snap back)
  • Loading branch information
Mark Pospesel committed Jun 29, 2012
1 parent c26461e commit 7d04b64
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Container/MPFlipViewController.m
Expand Up @@ -492,7 +492,14 @@ - (void)gotoPreviousPage

UIViewController *previousController = [[self dataSource] flipViewController:self viewControllerBeforeViewController:[self viewController]];
if (!previousController)
{
[self setRubberbanding:YES];
[self startFlipToViewController:nil fromViewController:self.childViewController withDirection:MPFlipViewControllerDirectionReverse];
[self.flipTransition performRubberband:^(BOOL finished) {
[self endFlipAnimation:finished transitionCompleted:NO completion:nil];
}];
return;
}

[self setGestureDriven:YES];
[self setViewController:previousController direction:MPFlipViewControllerDirectionReverse animated:YES completion:nil];
Expand All @@ -505,7 +512,14 @@ - (void)gotoNextPage

UIViewController *nextController = [[self dataSource] flipViewController:self viewControllerAfterViewController:[self viewController]];
if (!nextController)
{
[self setRubberbanding:YES];
[self startFlipToViewController:nil fromViewController:self.childViewController withDirection:MPFlipViewControllerDirectionForward];
[self.flipTransition performRubberband:^(BOOL finished) {
[self endFlipAnimation:finished transitionCompleted:NO completion:nil];
}];
return;
}

[self setGestureDriven:YES];
[self setViewController:nextController direction:MPFlipViewControllerDirectionForward animated:YES completion:nil];
Expand Down

0 comments on commit 7d04b64

Please sign in to comment.