Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to take a screenshot of an iPhone screen in iOS

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 314
    Comment on it

    Some times we don't get a correct screenshot of an iOS device. Specially when we apply some transform or animation. If you are applying affine transform or 3dTransform to an object and hoping for a perfect screenshot with same transform value then you are seriously in trouble. But don't worry about it. After spending hours on this issue finally I have got solution. Feeling glad to share this with you.

    - (UIImage *)snapshot:(UIView *)view{
        UIGraphicsBeginImageContextWithOptions(view.bounds.size, NO, 0.0);
        // This will Render your device snapshot into the image context
        [view drawViewHierarchyInRect:view.bounds afterScreenUpdates:YES];
    
        // Now this will help you to get the image from the context
        UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
    
        UIGraphicsEndImageContext();
        return viewImage;
    }

    Hope this would help you to get a perfect screenshot.

    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: