如何旋转CGContextDrawImage()中心绘制的图像?
在 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);
Run Code Online (Sandbox Code Playgroud)
我在原点绘制图像,然后在中心旋转图像,然后转换到应该绘制的位置.不工作.
core-graphics cgcontext cgaffinetransform ios cgcontextdrawimage