【问题标题】:How to get current position of animating uiview in ios如何在ios中获取动画uiview的当前位置
【发布时间】:2016-01-18 09:14:13
【问题描述】:

我想要在动画期间为 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"];

如果有人知道,请回答。 提前谢谢!

【问题讨论】:

    标签: ios objective-c uiview position cabasicanimation


    【解决方案1】:

    使用此代码:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-03
      • 1970-01-01
      • 2016-08-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多