Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Me1000
Created October 29, 2012 06:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Me1000/3971902 to your computer and use it in GitHub Desktop.
Save Me1000/3971902 to your computer and use it in GitHub Desktop.
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
const CGFloat threshHold = -60.0f;
const float minOpacity = 0.2;
CGFloat currentOffset = [scrollView contentOffset].x;
if (currentOffset < 0.0)
{
CGFloat currentProgress = currentOffset / threshHold;
[scrollView setAlpha:MAX(1.0 - (1.0 * currentProgress), minOpacity)];
if (currentOffset / threshHold >= 1.7)
[self.navigationController popViewControllerAnimated:YES];
}
}
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{
const CGFloat threshHold = -60.0f;
CGFloat currentOffset = [scrollView contentOffset].x;
if (currentOffset / threshHold >= 1.0)
[self.navigationController popViewControllerAnimated:YES];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment