After Animation, View position resets

后端 未结 6 518
悲哀的现实
悲哀的现实 2020-12-08 10:42

I am trying to make a view slide from top to bottom. This is not a big deal, I used CABasicAnimation for this. The problem is when I want to remove the view. I

6条回答
  •  爱一瞬间的悲伤
    2020-12-08 11:00

    I had this issue when performing several animations in an animation group. I had to set a couple properties on the animation group itself, not the individual animations.

    CAAnimationGroup *animGroup = [CAAnimationGroup animation];
    
    // MAKE SURE YOU HAVE THESE TWO LINES.
    animGroup.removedOnCompletion = NO;
    animGroup.fillMode = kCAFillModeForwards;
    
    animGroup.animations = [NSArray arrayWithObjects:moveAnim, scaleAnim, nil];
    animGroup.duration = tAnimationDuration;
    [tImageView.layer addAnimation:animGroup forKey:nil];
    

提交回复
热议问题