Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Crop an image from UIImageView

    • 0
    • 2
    • 3
    • 0
    • 0
    • 0
    • 0
    • 0
    • 133
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: