Iphone – Rotation and resizing the image + iPhone

iphone

I am trying to resize and rotate an image over the iPhone.
i picked the image and displayed it using UIImageView

and rotation of the image is done by two buttons (for clockwise & counterclockwise)

resizing of image works fine while rotation button not pressed
but when i pressed to rotate image into clockwise direction and the resize the image, width of the image increases rapidly even i am trying to decrease the width.

and when i pressed to rotate image into counterclockwise direction and the resize the image, height of the image increases rapidly even i am trying to decrease it.

i found that there is some sign changed while rotating the image along with the value, coz once press the clockwise button and then counterclockwise button, and then resizing works fine.

i used the following code for rotating the image.

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

where movingAngle is in Radians
and imageViewRotation is the UIImageView which contains the image.

waiting for your reply

Best Answer

You can make this happen smoother by making it an animation:

[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];
Related Topic