Iphone 我可以裁剪缩放后的图像吗。固定堇酸盐
问题:缩放后是否可以在固定坐标(50,50200200)处裁剪图像?我在谷歌上搜索了好几个小时,看到了匹配的问题。但是没有得到答案 谢谢 我的裁剪逻辑就在这里Iphone 我可以裁剪缩放后的图像吗。固定堇酸盐,iphone,ios,image,crop,Iphone,Ios,Image,Crop,问题:缩放后是否可以在固定坐标(50,50200200)处裁剪图像?我在谷歌上搜索了好几个小时,看到了匹配的问题。但是没有得到答案 谢谢 我的裁剪逻辑就在这里 CGSize itemSize = CGSizeMake(200, 200); UIGraphicsBeginImageContextWithOptions(itemSize, NO, 0); CGRect imageRect = CGRectMake(50, 50, 200, 200); [imageView1.image drawIn
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中显示的裁剪图像。回答我自己的问题:在谷歌搜索后,我找到了一个链接。经过一点修改后,它对我来说很好 也许可以节省别人的时间和精力。谢谢
UIGraphicsBeginImageContext(CGSizeMake(200, 200));
[scrollView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *fullScreenshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
imageView1.contentMode = UIViewContentModeScaleAspectFill;
UIImageWriteToSavedPhotosAlbum(fullScreenshot, nil, nil, nil);
return fullScreenshot;
导入QuartzCore/QuartzCore.h
如果出现警告
UIGraphicsGetImageFromCurrentImageContext()代码>如果你继续问同一个问题,你不会得到答案,只需编辑原始问题。@iApple我简短地又问了一次。因为我问的前一个问题非常详细。