tags:

views:

410

answers:

2

Hello ,

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

A: 

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];
Jaba
A: 
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.5];

    // The transform matrix
    CGAffineTransform transformRotate = CGAffineTransformMakeRotation(movingAngle);
    imageViewRotation.transform = transformRotate;

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

    // Commit the changes
    [UIView commitAnimations];

i used the animation earlier but not returned me the desired thing. i tried it according to your suggestion once again but still the same problem is coming.

help me