rotate image using CGContextDrawImage
How can I rotate an image drawn by CGContextDrawImage() at its center? In drawRect: CGContextSaveGState(c); rect = CGRectOffset(rect, -rect.size.width / 2, -rect.size.height / 2); CGContextRotateCTM(c, angle); CGContextDrawImage(c, rect, doodad.CGImage); CGContextRotateCTM(c, -angle); CGContextTranslateCTM(c, pt.x, pt.y); prevRect = rect; CGContextRestoreGState(c); I draw the image at the origin, and rotate it at its center, then translate to where it should be drawn. Not working. The thing to remember about coordinate transformations—well, one of the things to remember—is that you are not