小编Sam*_*D R的帖子

是否可以在 CAKeyFrameAnimation 之后更新按钮的位置?

我一直在尝试在完成后更新按钮的位置CAKeyFrameAnimation。到目前为止,我已经在弧上的某个角度(最终角度)停止了动画,但是,按钮所进行的触摸似乎是在动画发生之前的那个点。

这是我一直在使用的代码:

for(int i = 0; i <numberOfButtons; i++)
{
    double angle = [[self.buttonsArray objectAtIndex:i] angle];

    if(angle != -50 && angle !=270){
        CGPoint arcStart = CGPointMake([[self.buttonsArray objectAtIndex:i] buttonForCricle].center.x, [[self.buttonsArray objectAtIndex:i] buttonForCricle].center.y);
        CGPoint arcCenter = CGPointMake(centerPoint.x, centerPoint.y);
        CGMutablePathRef arcPath = CGPathCreateMutable();
        CGPathMoveToPoint(arcPath, NULL, arcStart.x, arcStart.y);
        CGPathAddArc(arcPath, NULL, arcCenter.x, arcCenter.y, 150, ([[self.buttonsArray objectAtIndex:i] angle]*M_PI/180), (-50*M_PI/180), YES);
        UIButton *moveButton = (UIButton *)[self.view viewWithTag:i+1];
        CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
        pathAnimation.calculationMode = kCAAnimationPaced;
        pathAnimation.fillMode = kCAFillModeForwards;
        // pathAnimation.values = @[@0];
        pathAnimation.removedOnCompletion = NO; …
Run Code Online (Sandbox Code Playgroud)

animation objective-c ios

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

标签 统计

animation ×1

ios ×1

objective-c ×1