CABasicAnimation執行動畫完成後,創建的layer又回到的之前的位置,並且閃爍一下,需要創建的動畫添加一下兩行代碼:
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.translation.x"];
animation.removedOnCompletion = NO;
animation.fillMode = kCAFillModeForwards