简体   繁体   中英

UIImageView animation

I need to animate and imageview, first rotate it in one direction, shift the center and rotate it in the opposite direction in a single animation loop.

What i did was ::

[UIImageView beginAnimations:nil context:NULL];
[UIImageView setAnimationDuration:2.0];
[UIImageView setAnimationDelegate:self];
[UIImageView setAnimationWillStartSelector:@selector(setRightAngle)];

image.center = CGPointMake(newCenter.x, newCenter.y) ;

[UIImageView setAnimationDidStopSelector:@selector(setStraight)];
[UIImageView commitAnimations];

This is getting the job done, but it happens in 3 steps that is noticeable on the screen. it first turns right,then shifts the center and the set the image to the default angle. i want to remove that noticeable breaks in between to achieve a smooth animation. Can some one suggest me a better approach to this issue?

Thanks & Regards, NR

You might want to post your setStraight and setRightAngle methods.

You could also look into formatting the code in your question for better readability.

Since you have noticeable breaks, you could add a timer, and see when your methods are firing, to see when the breaks occur.

I can say from experience that it is possible to use the technique you list here to have smooth animation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM