Rodar imagem usando CGContextDrawImage
Como posso girar uma imagem desenhada porCGContextDrawImage()
no seu centro?
EmdrawRect:
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);
Eu desenho a imagem na origem e giro-a em seu centro, depois traduzo para onde ela deve ser desenhada. Não está funcionando.