0

CAAnimation でのアニメーション化に問題があります。エラーは発生していないようですが、アニメーション化されていません。よくわかりません

NSMutableArray *animationImages = [NSMutableArray array];
//Adding images into array
for (int i=0;i<=5;i++){
    UIImage *imgfile = [NSString stringWithFormat:@"%@/ConusOverlay/%d_ConusOverlay.gif",documentsPath,i];
    [animationImages addObject: imgfile];
}

CAKeyframeAnimation *animationSequence = [CAKeyframeAnimation animationWithKeyPath: @"contents"];
animationSequence.calculationMode = kCAAnimationLinear;
animationSequence.autoreverses = NO;
animationSequence.duration = 1;
animationSequence.repeatCount = HUGE_VALF;

NSMutableArray *animationSequenceArray = [NSMutableArray array];
for (UIImage *image in animationImages) {
    [animationSequenceArray addObject:image]; //<--Does this have to be (id)image.CGImage ?, if I am correct you are unable to add CGImage to an array
}
animationSequence.values = animationSequenceArray;
[mlLayer.contents addAnimation:animationSequence forKey:@"contents"];
4

1 に答える 1

1

CoreAnimation は通常、 ではCGImageRefなくを受け取りますUIImages。あなたが提案imageしたように をに置き換えてみてください。(id)image.CGImage配列は s を格納できCGImageRefます!

于 2012-02-07T18:54:36.633 に答える