#define radians(degrees) (degrees * M_PI/180)
UIImage *rotate(UIImage *image) {
CGSize size = image.size;;
UIGraphicsBeginImageContext(size);
CGContextRef co
If you don't want to change all the origins and sizes, move the center, rotate and change the center to corner again like this:
CGContextTranslateCTM( context, 0.5f * size.width, 0.5f * size.height ) ;
CGContextRotateCTM( context, radians( 90 ) ) ;
CGContextTranslateCTM( context, -0.5f * size.width, -0.5f * size.height ) ;
Then draw normally like this:
[image drawInRect:CGRectMake(0, 0, size.width, size.height)];