Skip to content

Commit

Permalink
Fuck it ship it
Browse files Browse the repository at this point in the history
  • Loading branch information
sammoore committed Sep 13, 2014
1 parent f23ef94 commit 9f9329a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Tranquility/Tranquility/SummaryView.xib
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<connections>
<outlet property="circleView" destination="ceJ-Uk-Ehb" id="iZa-8G-ebE"/>
</connections>
<point key="canvasLocation" x="96" y="56"/>
<point key="canvasLocation" x="146" y="71"/>
</view>
</objects>
</document>
2 changes: 1 addition & 1 deletion Tranquility/Tranquility/UIScrollView+APParallaxHeader.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
31 changes: 19 additions & 12 deletions Tranquility/Tranquility/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down Expand Up @@ -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
Expand All @@ -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;
}
}
Expand All @@ -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 {
Expand Down

0 comments on commit 9f9329a

Please sign in to comment.