UIImage iPhone Rotate 37.8 degrees

iphone, rotation, uiimage

Solution

To rotate the view:

imageView.transform = CGAffineTransformMakeRotation(37.8°);

To rotate the image,

- Calculate the width and height will be occupied by the image after rotation.

- Create a `CGContext` by `UIGraphicsBeginImageContext`.

- `CGContextRotateCTM(UIGraphicsGetCurrentContext(), 37.8°);`

- `[yourImage drawAtPoint:...];`

- `UIGraphicsGetImageFromCurrentImageContext();` and use this image instead.

- Release the context.

Problem

After I load an image from the device, I need to rotate it 37.8 degrees then display it on a View. Is there an function in Objective-C that can do the image rotation? Ian

Original source