ios 绘图笔记--CGContextTranslateCTM

来源:互联网 发布:js数组删除某个元素 编辑:程序博客网 时间:2024/05/29 10:38

我们在使用“CGContextShowTextAtPoint”,经常会遇到字体翻转问题。CGContextShowTextAtPoint word upside.

这个问题可以通过


    CGContextTranslateCTM(ctx, 0, imageSize.height);
    CGContextScaleCTM(ctx, 1, -1);

解决。

不过要是想继续正常绘制其他内容,我们可以采用先存储后恢复的方式


CGAffineTransform normalState=CGContextGetCTM(context);

    CGContextTranslateCTM(ctx, 0, imageSize.height);
    CGContextScaleCTM(ctx, 1, -1);


 CGContextConcatCTM(context, normalState);


原创粉丝点击