2016-01-18 2 views
0

Мне нужна текущая позиция анимации UIView во время анимации, и я использую этот код.Как получить текущую позицию анимации uiview в ios

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"]; 

Ответьте, если кто-нибудь об этом узнает. Спасибо заранее!

ответ

4

Используйте этот код:

CGRect currentCenter = [drawingView.layer.presentationLayer center]; 

или

CGRect currentFrame = [DropImage.layer.presentationLayer frame];