CAKeyframeAnimation에서이 문제가 발생합니다. UIView의 레이어에 애니메이션을 적용한 후에는 사용자가이 UIView에서 버튼을 계속 사용할 수 있도록 애니메이션을 적용하는 위치에 UIView를 배치하고 싶습니다.CAKeyframeAnimation 후에 UIView를 배치하면 디스플레이 결함이 발생합니다
// Open animation
CAKeyframeAnimation *openAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.translation.y"];
openAnimation.fillMode = kCAFillModeForwards;
openAnimation.duration = .55;
openAnimation.delegate = self;
openAnimation.removedOnCompletion = NO;
openAnimation.values = [NSArray arrayWithObjects:
[NSNumber numberWithFloat:0.0],
[NSNumber numberWithFloat:58.0],
[NSNumber numberWithFloat:48.0], nil];
openAnimation.keyTimes = [NSArray arrayWithObjects:
[NSNumber numberWithFloat:0.0],
[NSNumber numberWithFloat:0.62],
[NSNumber numberWithFloat:1.0], nil];
openAnimation.timingFunctions = [NSArray arrayWithObjects:
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut], nil];
[locationView.layer addAnimation:openAnimation forKey:@"OPEN_ANIMATION"];
그리고 위임 방법 :
- (void)animationDidStop:(CAKeyframeAnimation *)anim finished:(BOOL)flag
{
locationView.y = -10.0;
}
이 실제로 작동하지만 결국에 나는 애니메이션이 제거됩니다이 디스플레이 결함에 봉착
나는 현재이 코드를 사용하고 있습니다 (UIView 레이어가 원래 위치로 점프) 즉시 즉시 위임 메서드를 호출하여 끝 위치로 이동합니다.
애니메이션이 완료되면 애니메이션의 마지막 프레임을 렌더링하고 원래 위치로 점프하고이 프레임을 렌더링하고 위임 메서드를 호출하고 끝 부분에 uiview를 놓습니다. 위치.
어떻게하면이 디스플레이 결함을 해결할 수 있습니까?