我已經使用下面的代碼裁剪了我的圖像。調整裁剪圖像的大小Objective-C
- (UIImage *)crop:(CGRect)rect image:(UIImage *)image {
if (image.scale > 1.0f) {
rect = CGRectMake(rect.origin.x * image.scale,
rect.origin.y * image.scale,
rect.size.width * image.scale,
rect.size.height * image.scale);
}
CGImageRef imageRef = CGImageCreateWithImageInRect(image.CGImage, rect);
UIImage *result = [UIImage imageWithCGImage:imageRef scale:image.scale orientation:image.imageOrientation];
CGImageRelease(imageRef);
return result;
}
- (void)function
{
CGRect nf = CGRectMake(0, 0, 325, 303); //The area I need to crop
imageView.image = [self crop:nf image:imageView.image];
// Here I need to resize the new image
}
現在,我需要調整我裁剪的這張圖片的大小。我想:
- 更改框架 - >沒有影響
- 縮放與 'CGAffineTransformMakeScale' 圖像 - >沒有影響
我需要你的幫助,請。
編輯:我試圖改變幀這樣的:
imageView.frame = CGRectMake(X,Y,寬度,高度);
你可以發佈鱈魚你嘗試過什麼? – iCoder
可能重複的[最簡單的方法來調整UIImage?](http://stackoverflow.com/questions/2658738/the-simplest-way-to-resize-an-uiimage) – Wain