CABasicAnimation在CALayer“setFrame”之后立即命名,为什么?

时间:2015-03-02 08:40:15

标签: objective-c animation calayer

-(void)startAnimationWithTime:(CGFloat)animationTime
                    fromPoint:(CGPoint)fromPoint
                      toPoint:(CGPoint)toPoint
                   Completion:(SYBDanmakuAnimationCompletion)completion
{
    [CATransaction begin];
    [CATransaction setDisableActions:YES];
    [CATransaction setCompletionBlock:^{
        completion(YES);
    }];
    CABasicAnimation *mover = [CABasicAnimation animationWithKeyPath:@"position"];
    [mover setDuration:animationTime];
    [mover setFromValue:[NSValue valueWithCGPoint:fromPoint]];
    [mover setToValue:[NSValue valueWithCGPoint:toPoint]];
    [self addAnimation:mover forKey:@"move"];
    [CATransaction commit];
}

这是myLayer的代码,当我更改其superLayer的框架时,此动画将立即完成,谁能告诉我原因?我希望它能正常工作。

0 个答案:

没有答案