ios - 动画组 运行时崩溃
怪我咯
怪我咯 2017-04-18 09:49:20
0
1
394

代码如下

 __block NSMutableArray *animaArr = [[NSMutableArray alloc] initWithCapacity:200];
for ( int i = 3 ; i > 0 ; i-- ) { 
            CAKeyframeAnimation *anima1 = [CAKeyframeAnimation animationWithKeyPath:@"position"];
            NSValue *value0 = [NSValue valueWithCGPoint:CGPointMake(30,40)];
            NSValue *value1 = [NSValue valueWithCGPoint:CGPointMake(50,60)];
            anima1.values = [NSArray arrayWithObjects:value0,value1, nil];
            [animaArr addObject:anima1.values];
        }
        
CAAnimationGroup *groupAnimation = [CAAnimationGroup animation];
groupAnimation.animations = animaArr;
groupAnimation.duration = 5;
[_movingChipImgView.layer addAnimation:groupAnimation forKey:nil];

崩溃信息

-[__NSArrayI setDefaultDuration:]: unrecognized selector sent to instance 0x608000222800
怪我咯
怪我咯

走同样的路,发现不同的人生

Antworte allen(1)
小葫芦

[animaArr addObject:anima1.values]; ==> [animaArr addObject:anima1];

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage