Reputation: 67
I am trying to move an imageView according to coordinates I get in realtime from the server. The movement of the image is lagging, if I use a CGPath instead of an imageView it is very smooth so the issue is not from the server.
Is there a better efficient way to move an imageView by updating its X and Y continuously.
I am using the code below to update the imageView coordinates.
imgView.frame=CGRectMake(x-70/2, y-70/2, 70, 70);
Upvotes: 0
Views: 339
Reputation: 81878
Use UIView's animation APIs:
[UIView animateWithDuration:0.5
animations:^{
imgView.frame = CGRectMake(x-70/2, y-70/2, 70, 70);
}
completion:nil];
Upvotes: 1