From 9a04a0a173c11684f33d7c90ee9b07ba780fb21f Mon Sep 17 00:00:00 2001 From: Akring Date: Wed, 10 Jun 2015 16:42:33 +0800 Subject: [PATCH 1/2] Fix bug for scrollView and POP animation --- MSender/ViewController.m | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/MSender/ViewController.m b/MSender/ViewController.m index 7f2fb92..27d28e1 100755 --- a/MSender/ViewController.m +++ b/MSender/ViewController.m @@ -106,7 +106,7 @@ - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView _LNew.alpha = 0; - + [self pop_removeAllAnimations]; } -(void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView{ @@ -133,8 +133,11 @@ - (void)popAnimation { animation.springSpeed = 8; animation.completionBlock = ^(POPAnimation *anim, BOOL finished){ - [self.scview setContentOffset:CGPointMake(0, 0)]; - [self pop_removeAnimationForKey:@"popAnimation"]; + if (finished) { + + [self.scview setContentOffset:CGPointMake(0, 0)]; + [self pop_removeAnimationForKey:@"popAnimation"]; + } }; animation.property = [POPAnimatableProperty propertyWithName:@"popAnimationProgress" initializer:^(POPMutableAnimatableProperty *prop) { prop.readBlock = ^(ViewController *obj, CGFloat values[]) { @@ -209,13 +212,14 @@ - (void) parallax{ //Wave the trees when the plan fly across them:) - (void)setTreeWave{ - _treeWaveProgress = -0.33; POPSpringAnimation *animation = [self pop_animationForKey:@"treeWaveAnimation"]; if (!animation) { animation = [POPSpringAnimation animation]; animation.springBounciness = 30; animation.springSpeed = 5; + animation.fromValue = @(-0.33); + animation.toValue =@(0.01); animation.completionBlock = ^(POPAnimation *anim, BOOL finished){ if (finished) { @@ -236,7 +240,7 @@ - (void)setTreeWave{ [self pop_addAnimation:animation forKey:@"treeWaveAnimation"]; } - animation.toValue =@(0.01); + } - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context From e9800ac76b11278d979f677f6ac5477c83eb0aa5 Mon Sep 17 00:00:00 2001 From: Akring Date: Wed, 10 Jun 2015 18:01:32 +0800 Subject: [PATCH 2/2] Add corner radius for the base view,so that we can get a better effect --- MSender/ViewController.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MSender/ViewController.m b/MSender/ViewController.m index 27d28e1..b85b3ba 100755 --- a/MSender/ViewController.m +++ b/MSender/ViewController.m @@ -67,6 +67,9 @@ - (void)viewDidLoad { //Add Tree & Filter [self TreeImagenFilter]; + self.view.layer.masksToBounds = YES; + self.view.layer.cornerRadius = 8; + [self addObserver:self forKeyPath:@"treeWaveProgress" options:NSKeyValueObservingOptionNew context:nil]; }