iOS中的图像旋转 [英] Image rotation in iOS

查看:32
本文介绍了iOS中的图像旋转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将图像延迟 360 度旋转 2 或 3 秒,再次将其旋转 360 度,该过程应继续进行.有什么可能的建议吗?实际上尝试过 Cgaffinetransfom 但它不适用于 360 度.

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 .

推荐答案

您可以像这样旋转图像:

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];

旋转功能:

-(void)doRotateImage{
    [YourImageView setTransform:CGAffineTransformMakeRotation(10*(M_PI/360))];
}

就是这样.

这篇关于iOS中的图像旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆