相关疑难解决方法(0)

使用pop创建无尽的动画?

使用Coreanimation框架时,我可以设置动画重复.我想设置一个"吸引注意"模式的按钮,这将使他成长和缩小一小部分以引起用户的注意.

我已经通过完成块链接了增长和缩小动画.问题是我是否以及如何从第二个动画的完成块开始第一个动画.

我确实收到了以下有意义的警告.这个问题的优雅解决方案是什么?我不喜欢为这样的东西创造计时器.

在此块中强烈捕获'scaleAnimation'可能会导致保留周期

- (void)attractAttention:(BOOL)flag{
    _attractAttention = flag;
    float resizeValue = 1.2f;

        // Grow animation
    POPSpringAnimation *scaleAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerScaleXY];
    scaleAnimation.fromValue  = [NSValue valueWithCGSize:CGSizeMake(1.0f, 1.0f)];
    scaleAnimation.toValue  = [NSValue valueWithCGSize:CGSizeMake(resizeValue, resizeValue)];
    scaleAnimation.completionBlock = ^(POPAnimation *anim, BOOL finished) {
            // Grow animation done
        POPSpringAnimation *scaleAnimationDown = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerScaleXY];
        scaleAnimationDown.fromValue  = [NSValue valueWithCGSize:CGSizeMake(resizeValue, resizeValue)];
        scaleAnimationDown.toValue  = [NSValue valueWithCGSize:CGSizeMake(1.0f, 1.0f)];

        scaleAnimationDown.completionBlock = ^(POPAnimation *anim, BOOL finished) {
                // Shrink animation done
            if (_attractAttention) {
                [self.layer pop_addAnimation:scaleAnimation forKey:@"scaleUpAnimation"];
            }
        };

        [self.layer pop_addAnimation:scaleAnimationDown forKey:@"scaleDownAnimation"];
    }; …
Run Code Online (Sandbox Code Playgroud)

animation ios facebook-pop

0
推荐指数
1
解决办法
2618
查看次数

标签 统计

animation ×1

facebook-pop ×1

ios ×1