【问题标题】:xcode image position x y update realtimexcode 图像位置 x y 实时更新
【发布时间】:2014-08-05 14:40:04
【问题描述】:

我正在尝试根据从服务器实时获取的坐标移动 imageView。图像的移动是滞后的,如果我使用 CGPath 而不是 imageView,它会非常流畅,所以问题不在于服务器。

有没有更有效的方法来移动一个 imageView,通过不断更新它的 X 和 Y。

我正在使用下面的代码来更新 imageView 坐标。

imgView.frame=CGRectMake(x-70/2, y-70/2, 70, 70);

【问题讨论】:

    标签: ios xcode animation real-time


    【解决方案1】:

    使用 UIView 的动画 API:

    [UIView animateWithDuration:0.5
                     animations:^{
                         imgView.frame = CGRectMake(x-70/2, y-70/2, 70, 70);
                     }
                     completion:nil];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-16
      • 2016-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多