Created
October 29, 2012 06:20
-
-
Save Me1000/3971902 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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