Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/105.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios xcode图像位置x y实时更新_Ios_Xcode_Animation_Real Time - Fatal编程技术网

Ios xcode图像位置x y实时更新

Ios xcode图像位置x y实时更新,ios,xcode,animation,real-time,Ios,Xcode,Animation,Real Time,我正在尝试根据从服务器实时获取的坐标移动imageView。图像的移动是滞后的,如果我使用CGPath而不是imageView,它会非常平滑,因此问题不是来自服务器 是否有一种更有效的方法通过不断更新其X和Y来移动imageView 我正在使用下面的代码更新imageView坐标 imgView.frame=CGRectMake(x-70/2, y-70/2, 70, 70); 使用UIView的动画API: [UIView animateWithDuration:0.5

我正在尝试根据从服务器实时获取的坐标移动imageView。图像的移动是滞后的,如果我使用CGPath而不是imageView,它会非常平滑,因此问题不是来自服务器

是否有一种更有效的方法通过不断更新其X和Y来移动imageView

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

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

使用UIView的动画API:

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