1
keyframeAnimation을 사용하여 UIView의 크기를 조정할 필요가 없습니다. 키 프레임 애니메이션이 떨어질 때 레이블 텍스트와 애니메이션을 동기화해야하기 때문입니다.CAKeyframeAnimation 눈금
그래서 내가 설정 크기 애니메이션
let sizeAnimation = CAKeyframeAnimation(keyPath: "transform.scale")
sizeAnimation.duration = 1.2
let animationTime = TimeInterval(1.2/Float(volumeObjects.count - 1))
// Stride is an inverted for in, it goes from volumeObjects count to 0
var sizeAnimationValuesArray = [NSValue]()
var keyTimes = [NSNumber]()
var currentKeyTime: TimeInterval = 0
for index in stride(from: volumeObjects.count - 1, to: -1, by: -1) {
let currentPercentage = CGFloat(index)/CGFloat(volumeObjects.count)
sizeAnimationValuesArray.append(NSValue(caTransform3D: CATransform3DMakeScale(1.0, currentPercentage, 1.0)))
keyTimes.append(NSNumber(value: currentKeyTime))
currentKeyTime += animationTime
}
sizeAnimation.values = sizeAnimationValuesArray
self.indicatorView.layer.add(sizeAnimation, forKey: "Bottom")
했습니다하지만 어떤 이유로, 그것이 작동하지 않는, 말 그대로 아무것도 당신은 실제로 아무것도에 대한 keyTimes
배열을 사용하지 않는