2010-02-04 124 views
2

我正在尝试调整大小并在iPhone上旋转图像。 我挑选的图像并使用的UIImageView旋转并调整图像大小+ iPhone

和图像的旋转通过两个按钮(顺时针&逆时针)进行显示它

而按压旋转按钮没有按下 图像的尺寸调整工作正常,但是当我压到将图像旋转为顺时针方向并调整图像大小,图像宽度快速增加,即使我试图减小宽度。

当我按下旋转图像逆时针方向和调整图像的大小,图像的高度迅速增加,即使我试图减少它。

我发现有一些符号在旋转图像的同时随着值的变化而改变,一次按顺时针按钮,然后逆时针按钮,然后调整大小工作正常。

我用下面的代码来旋转图像。

CGAffineTransform transformRotate = CGAffineTransformMakeRotation(movingAngle); 
imageViewRotation.transform = transformRotate; 

其中movingAngle以弧度 和imageViewRotation是包含图像的UIImageView。

等待你的答复

+0

你能不能从现在开始重新设置代码,请。在代码前添加4个空格,它将被编辑为看起来像代码。不要从现在开始大胆。 – Jaba 2010-02-04 14:03:57

回答

0

你可以做到这一点通过使动画更流畅:

[UIView beginAnimations:nil contextNULL]; 
[UIView setAnimationDuration:.5; 

CGAffineTransform transformRotate = CGAffineTransformMakeRotation(movingAngle); 
imageViewRotation.transform = transformRotate; 

CGRect frame = /*make the new frame or set it to -->*/self.view.frame; 
imageViewRotation.frame = newFrame; 

[UIView commitAnimations];