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 :
- Changing the frame -> no effect
- Scaling image with 'CGAffineTransformMakeScale' -> no effect
I need your help please.
EDIT : I tried to change frame like this :
imageView.frame = CGRectMake(x, y, width, height);