Quartz和Uikit坐标系:
UIImage *image = [UIImage imageNamed:@"lx_20180118102017.png"];
UIGraphicsBeginImageContext(image.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextDrawImage(context, CGRectMake(0, 0, image.size.width, image.size.height), [image CGImage]);
image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageView *imageV = [[UIImageView alloc]initWithImage:image];
imageV.frame = self.view.bounds;
[self.view addSubview:imageV];
上下文中加入转换坐标系代码:
CGContextRotateCTM(context, M_PI);
CGContextScaleCTM(context, -1, 1);
CGContextTranslateCTM(context, 0, -image.size.height);