suchen

Heim  >  Fragen und Antworten  >  Hauptteil

ios - 动画组 运行时崩溃

代码如下

 __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
怪我咯怪我咯2771 Tage vor398

Antworte allen(1)Ich werde antworten

  • 高洛峰

    高洛峰2017-04-18 09:51:20

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

    Antwort
    0
  • StornierenAntwort