0

I've got an image that I need crop. To do this, I wanted to use the contentMode (set it to Top/TopLeft instead of Aspect Fit) but when I'm doing this, the image go back to it's real size (and not the size I gave to it). So my question is :

How to crop the bottom of my image retaining its size ?

Thanks a lot.

Aeradriel
  • 1,224
  • 14
  • 36

1 Answers1

0

May be you have to set the rect for the imageView

imageView is the instance of UIImageView

Let the rectangle to be cropped is croppedRect

CGImageRef imageRef = CGImageCreateWithImageInRect([imageView.image CGImage], croppedRect);
[imageView setImage:[UIImage imageWithCGImage:imageRef]]; 
CGImageRelease(imageRef);
Himanshu Joshi
  • 3,391
  • 1
  • 19
  • 32