繁体   English   中英

如何在iOS中获取动画UIView的当前位置

[英]How to get current position of animating uiview in ios

我想要在动画过程中为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];

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM