I've cropped my image using the code below.
- (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
}
Now, I need to resize this picture that I cropped. I tried :
I need your help please.
EDIT : I tried to change frame like this :
imageView.frame = CGRectMake(x, y, width, height);
I guess I wasn't using CGAffineTransformMakeScale correctly because I finally reach it writing
imageView.transform = CGAffineTransformMakeScale(0.x, 0.x);