I want to rotate an image by 360 degree delay for 2 or 3 seconds again rotate it by 360 degree and the process should continue on. Any possible suggestions for the same ? Actually tried Cgaffinetransfom but its not working for 360 degree .
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You can rotate your image like this:
[YourImageView setTransform:CGAffineTransformMakeRotation(10*(M_PI/360))];
Now to perform it continuous you need to set the timer like this:
[NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(doRotateImage) userInfo:nil repeats:YES];
Rotate function:
-(void)doRotateImage{
[YourImageView setTransform:CGAffineTransformMakeRotation(10*(M_PI/360))];
}
Thats it.
回答2:
You could try this method:
- (void)rotateImageView{
[UIView animateWithDuration:0.4f delay:0 options:UIViewAnimationOptionCurveLinear animations:^{
[yourImageView setTransform:CGAffineTransformRotate(yourImageView.transform, M_PI_2)];
}completion:^(BOOL finished){
if (finished) {
[self rotateImageView];
}
}];
}