With the following method stated below you can crop an UIImageView.
-(UIImage *)cropedImage:(UIView *)view{
UIGraphicsBeginImageContextWithOptions(view.frame.size, imageView.opaque, 4.0);
CGContextRef c = UIGraphicsGetCurrentContext();
CGContextConcatCTM(c, CGAffineTransformMakeTranslation(-view.frame.origin.x, -view.frame.origin.y));
[imageView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}
This method will require an UIView which will slide over the UIImageView to get a frame.
Happy coding...
0 Comment(s)