scale and crop image ios

前端 未结 1 410
一个人的身影
一个人的身影 2021-01-14 16:42

I\'m working in a function for scaling and crop image (similar to camara app) for iOS, the code below works fine, just that the resulting image came up side down, and I woul

1条回答
  •  孤街浪徒
    2021-01-14 17:33

    I've also came across this issue without explanation. But have found a workaround that solves that problem. Just put the following two lines in your code and try it again. It works for me.

    CGContextTranslateCTM(context, 0.0, newRect.size.height);
    CGContextScaleCTM(context, 1.0, -1.0);//flip context
    

    0 讨论(0)
提交回复
热议问题