【发布时间】:2013-07-31 09:11:45
【问题描述】:
如何在不使用 CGAffineTransform 的情况下绘制小于上下文大小的图像?
UIGraphicsBeginImageContext(size);
CGContextRef context = UIGraphicsGetCurrentContext();
// center image
CGContextTranslateCTM(context, placement.origin.x, placement.origin.y);
[imageView.layer renderInContext:context];
问题在于,如果imageView.image.size 大于size,它将居中绘制,但在边界处剪切(图像大于绘图区域)。我希望图像适合,所以想减小imageView.image.size 的大小。有没有办法使用renderInContext 来实现这一点?
【问题讨论】:
标签: ios cocoa-touch core-graphics cgcontext