Facebook POP动画延迟

时间:2014-10-10 13:19:57

标签: ios xcode uianimation facebook-pop

我有关于bouncies动画效果的难度,每当我向下滑动时,两个UI元素向下滑动,第一个是容器(其中包含UIPickerView)并且它改变坐标(x,y)和w / h值,第二个UI是只是拉开/关闭,我只是应用它的坐标。我正在使用FacebookPOP框架,我也应用了反弹效果。首先拉下来,2 UI有一个尾随空间,同时保持弹跳效果。如果没有更改或刷新视图控制器,则会按照我的预期发生第二次/第三次向下滑动操作。

向下/向上滑动时我的代码如下:

if(sender.direction == UISwipeGestureRecognizerDirectionDown)
{

    isDown = YES;

    POPSpringAnimation *bounceForControlView = [POPSpringAnimation animation];

    bounceForControlView.property = [POPAnimatableProperty propertyWithName:kPOPViewFrame];

    bounceForControlView.toValue=[NSValue valueWithCGRect:CGRectMake(0, 241, 320, 42)];

    bounceForControlView.springBounciness = 15;

    bounceForControlView.springSpeed = 10;


    [controlView pop_addAnimation:bounceForControlView forKey:@"bounceForControlView"];

    POPSpringAnimation *bounceForPickerView = [POPSpringAnimation animation];

    bounceForPickerView.property = [POPAnimatableProperty propertyWithName:kPOPViewFrame];

    bounceForPickerView.toValue=[NSValue valueWithCGRect:CGRectMake(0, 64, 320, 177)];

    bounceForPickerView.springBounciness = 15;

    bounceForPickerView.springSpeed = 10;

    [swipeView pop_addAnimation:bounceForPickerView forKey:@"bounceForPickerView"];

    [UIView animateWithDuration:0.7 animations:^() {

        [pullUPImage setAlpha:1.0];

        [self.pullImage setAlpha:0.0];

    }];

    [UIView animateWithDuration:0.7 animations:^() {

        [myPicker setHidden:NO];

    }];

}
if(sender.direction == UISwipeGestureRecognizerDirectionUp)
  {
    isDown = NO;

    [myPicker setHidden:YES];

    popAnimation = [POPSpringAnimation animation];

    popAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewFrame];

    popAnimation.toValue=[NSValue valueWithCGRect:CGRectMake(0, 64, 320, 0)];

    popAnimation.springBounciness = 5;

    popAnimation.springSpeed = 5;

    [swipeView pop_addAnimation:popAnimation forKey:@"slide"];

    popAnimation = [POPSpringAnimation animation];

    popAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewFrame];

    popAnimation.toValue=[NSValue valueWithCGRect:CGRectMake(0, 64, 320, 42)];

    popAnimation.springBounciness = 5;

    popAnimation.springSpeed = 5;

    [controlView pop_addAnimation:popAnimation forKey:@"slide"];

    [UIView animateWithDuration:0.5 animations:^() {

        [pullUPImage setAlpha:0.0];

        [self.pullImage setAlpha:1.0];
    }];
}

这就是动画实时运作的方式:

in action

0 个答案:

没有答案