我想要在动画期间为 UIView 设置动画的当前位置,我正在使用此代码。
CABasicAnimation * m_pAnimationObj = [CABasicAnimation animationWithKeyPath:@"transform.translation"];
[m_pAnimationObj setFromValue:[NSValue valueWithCGPoint:CGPointMake(0,-50)]];
[m_pAnimationObj setToValue:[NSValue valueWithCGPoint:CGPointMake(0,[UIScreen mainScreen].bounds.size.height+100)]];
m_pAnimationObj.duration = 2.0;
m_pAnimationObj.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
[DropImage.layer addAnimation:m_pAnimationObj forKey:@"animations"];
请知道的人回答一下。 提前致谢!
最佳答案
使用这段代码:
CGRect currentCenter = [drawingView.layer.presentationLayer center];
或
CGRect currentFrame = [DropImage.layer.presentationLayer frame];
关于ios - 如何在 ios 中获取动画 uiview 的当前位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34850983/