-1
我有每一個不同的路徑給它3 CAShapeLayer,但三個層的施加了相同的動畫,那就是:CAAnimation確定哪個動畫是
[self animateToLineLayer:self.leftDottedLine_ withKey:@"leftLineAnimated"];
- (void) animateToLineLayer:(CAShapeLayer *) line withKey:(NSString *) key
{
CABasicAnimation *pathAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
[pathAnimation setFromValue:[NSNumber numberWithFloat:0.0f]];
[pathAnimation setToValue:[NSNumber numberWithFloat:1.0f]];
[pathAnimation setDuration:10.0];
[pathAnimation setDelegate:self];
[pathAnimation setFillMode:kCAFillModeForwards];
[line addAnimation:pathAnimation forKey:key];
}
then I try to find this animation back by doing:
- (void)animationDidStop:(CAAnimation *)animation finished:(BOOL)flag
{
if (animation == [self.leftDottedLine_ animationForKey:@"strokeEnd"]) {
NSLog(@"DONE");
}
if (![self.leftDottedLine_ isNotNull]){
NSLog(@"NIL");
}
NSLog(@"JUST DONE");
}
但問題是,它從未打印完成!爲什麼是這樣?