Reputation: 432
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?
Upvotes: 1
Views: 3641
Reputation: 569
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.
Upvotes: 1
Reputation: 69499
Why not just rotate the UIImageView? Include QuartzCore framework.
#import <QuartzCore/QuartzCore.h>
self.imageView.layer.affineTransform = CGAffineTransformMakeRotation(angle)
See the documentation on CGAffineTransformMakeRotation
Upvotes: 2
Reputation: 5393
CGAffineTransform rotateTransform = CGAffineTransformMakeRotation( DEGREES_TO_RADIANS( rotateValue ) );
myObject.transform = rotateTransform;
Upvotes: 1