使用CGContext时的图像绘制问题.图像水平镜像

moo*_*cle 2 iphone drawing uiimage cgcontext

当我UIImage* image使用下面的代码绘制UIView时,图像是水平镜像的.如果我画4,它就是这样的替代文字 ..

CGRect rect = CGRectMake(x, y, imageWidth, imageHeight);
CGContextDrawImage((CGContextRef) g, rect, ((UIImage*)image).CGImage);
Run Code Online (Sandbox Code Playgroud)

那就是问题所在???我做错了??? 或者如果有人知道如何解决它,请让我也知道.我非常感谢提前.

谢谢你的loooooooooot.

Dav*_*Liu 5

请参阅:CGContextDrawImage在传递UIImage.CGImage时将图像上下颠倒

[image drawInRect:rect]而不是CGContextDrawImage.