我可以裁剪缩放的图像。固定坐标
问题描述:
问题:我可以在缩放后的固定坐标(50,50,200,200)处裁剪图像吗?我搜索了很多小时,看到了匹配的问题。但没有得到答案。我可以裁剪缩放的图像。固定坐标
谢谢。
我种植的逻辑是在这里..
CGSize itemSize = CGSizeMake(200, 200);
UIGraphicsBeginImageContextWithOptions(itemSize, NO, 0);
CGRect imageRect = CGRectMake(50, 50, 200, 200);
[imageView1.image drawInRect:imageRect];
UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
,但我不能在裁剪滚动查看完整的图像。我想要缩放后显示在scrollView中的裁剪图像。
答
我自己的回答问题:谷歌搜索后,我找到了一个链接。 here经过一些修改后,它对我来说工作得很好。
可以省却别人的时间和精力。感谢
UIGraphicsBeginImageContext(CGSizeMake(200, 200));
[scrollView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *fullScreenshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
imageView1.contentMode = UIViewContentModeScaleAspectFill;
UIImageWriteToSavedPhotosAlbum(fullScreenshot, nil, nil, nil);
return fullScreenshot;
import QuartzCore/QuartzCore.h
如果
UIGraphicsGetImageFromCurrentImageContext();
如果你继续问同一个问题的警告,你不会得到ANS,只需编辑原来的问题。 – Dhruv 2012-07-12 09:34:30
@iApple我简单地问了一遍。因为我问的前一个问题非常详细。 – QueueOverFlow 2012-07-12 09:37:42