1

Currently I am fetching a random image from the iPad image library and showing it in UIImageView. I want to rotate it by some predefined angle which I can set.

I don't want any touch based rotation. How can I do that?

Cœur
  • 37,241
  • 25
  • 195
  • 267
user930195
  • 432
  • 1
  • 5
  • 19
  • possible duplicate of [How can I rotate an UIImageView by 20 degrees?](http://stackoverflow.com/questions/852863/how-can-i-rotate-an-uiimageview-by-20-degrees) – Brad Larson Dec 15 '11 at 19:32
  • refer the following links. You can get some ideas to rotate a image. 1. https://stackoverflow.com/questions/852863/how-can-i-rotate-an-uiimageview-by-20-degrees 2. https://stackoverflow.com/questions/1414923/how-to-rotate-uiimageview-with-fix-point 3. https://stackoverflow.com/questions/1315251/how-to-rotate-a-uiimage-90-degrees – iOS Nov 09 '11 at 11:48

3 Answers3

2

Why not just rotate the UIImageView? Include QuartzCore framework.

#import <QuartzCore/QuartzCore.h>

self.imageView.layer.affineTransform = CGAffineTransformMakeRotation(angle)

See the documentation on CGAffineTransformMakeRotation

rckoenes
  • 69,092
  • 8
  • 134
  • 166
1
CGAffineTransform rotateTransform = CGAffineTransformMakeRotation( DEGREES_TO_RADIANS( rotateValue ) );
myObject.transform = rotateTransform;
ader
  • 5,403
  • 1
  • 21
  • 26
1

you can use this one:

CGAffineTransform newTransform = CGAffineTransformMakeRotation((CGFloat)(90 * M_PI / 180.0));

self.imageView.transform = newTransform;

Here 90 in degree, You can use another angle.

Sudesh Kumar
  • 569
  • 3
  • 13