diff --git a/Tranquility/Tranquility/SummaryView.xib b/Tranquility/Tranquility/SummaryView.xib index e011804..3745cbc 100644 --- a/Tranquility/Tranquility/SummaryView.xib +++ b/Tranquility/Tranquility/SummaryView.xib @@ -58,7 +58,7 @@ - + diff --git a/Tranquility/Tranquility/UIScrollView+APParallaxHeader.m b/Tranquility/Tranquility/UIScrollView+APParallaxHeader.m index 3edfd43..4daa862 100755 --- a/Tranquility/Tranquility/UIScrollView+APParallaxHeader.m +++ b/Tranquility/Tranquility/UIScrollView+APParallaxHeader.m @@ -240,7 +240,7 @@ - (void)scrollViewDidScroll:(CGPoint)contentOffset { [self setState:APParallaxTrackingActive]; } - if(self.state == APParallaxTrackingActive) { + if(/* self.state == APParallaxTrackingActive */YES) { CGFloat yOffset = contentOffset.y*-1; if ([self.delegate respondsToSelector:@selector(parallaxView:willChangeFrame:)]) { [self.delegate parallaxView:self willChangeFrame:self.frame]; diff --git a/Tranquility/Tranquility/ViewController.m b/Tranquility/Tranquility/ViewController.m index 7034307..39b70c7 100644 --- a/Tranquility/Tranquility/ViewController.m +++ b/Tranquility/Tranquility/ViewController.m @@ -20,14 +20,6 @@ @implementation ViewController { - (void)viewDidLoad { [super viewDidLoad]; - self.tableView.tableHeaderView = ({ - UIView *view = [[UIView alloc] init]; - view.bounds = CGRectMake(0, 0, 0, 20.0f); - view.backgroundColor = [UIColor grayColor]; - - view; - }); - [self.tableView addParallaxWithView:self.contentView andHeight:568]; [self.tableView.parallaxView setDelegate:self]; @@ -128,6 +120,11 @@ - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL if (!decelerate) [self repositionScrollView:scrollView]; } +- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView +{ + NSLog(@"%f", scrollView.contentOffset.y); +} + #pragma mark - Sticky Scroll View - (void)repositionScrollView:(UIScrollView *)scrollView @@ -139,16 +136,26 @@ - (void)repositionScrollView:(UIScrollView *)scrollView int newOffsetRatio = (int)superHeight / (int)scrollViewOffset; int oldOffsetRatio = (int)superHeight / (int)_oldContentY; +// if (_targetContentY >= 0.5*-568) { +// [self.navigationController setNavigationBarHidden:NO animated:YES]; +// //self.navigationController.navigationBarHidden = NO; +// } else { +// [self.navigationController setNavigationBarHidden:YES animated:YES]; +// //self.navigationController.navigationBarHidden = YES; +// } + + NSLog(@"%d", newOffsetRatio); + if (newOffsetRatio == -1) { // parallaxview in view [scrollView setContentOffset:CGPointMake(0, -568) animated:YES]; //self.navigationController.navigationBarHidden = YES; } - else if (newOffsetRatio < -1 || (oldOffsetRatio < 0 && newOffsetRatio > 2)) + else if ((_targetContentY < -60 && _targetContentY > 0.5*-568) || (oldOffsetRatio < 0 && newOffsetRatio > 2)) { // tableview in view - [scrollView setContentOffset:CGPointMake(0, 0) animated:YES]; + [scrollView setContentOffset:CGPointMake(0, -60) animated:YES]; //self.navigationController.navigationBarHidden = NO; } } @@ -160,9 +167,9 @@ - (void)parallaxView:(APParallaxView *)view willChangeFrame:(CGRect)frame { } - (void)parallaxView:(APParallaxView *)view didChangeFrame:(CGRect)frame { - NSLog(@"%f %f %f %f", frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); + //NSLog(@"%f %f %f %f", frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); - if (frame.origin.y >= 0) { + if (frame.origin.y >= 0.5*-568) { [self.navigationController setNavigationBarHidden:NO animated:YES]; //self.navigationController.navigationBarHidden = NO; } else {