user2411400
user2411400

Reputation: 55

How to rotate imageview without lagging?

I am integrating a compass in my app, but the problem is the image view lag while rotating it. How can i fix this issue and making it like the app of apple which rotate with a nice way?

Here is the code that i am using:

float heading = -1.0f * M_PI * degree / 180.0f;
[UIView animateWithDuration:1.0f delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
    self.compassImageView.transform = CGAffineTransformMakeRotation(heading);
} completion:nil];

Here is the compass:

https://i.sstatic.net/JXF9A.png

Upvotes: 0

Views: 148

Answers (1)

Paul Cezanne
Paul Cezanne

Reputation: 8741

Just get rid of the animateWithDuration duration. You don't need it. I guess you want it since you want the motion to be smooth, but I have a similar app that shows roll and pitch and I just call

tiltImage.transform = CGAffineTransformMakeRotation(DegreesToRadians(angle));

and it moves smoothly.

You're just over thinking it here. (JustSid is right.)

Upvotes: 1

Related Questions