Handy Category That Allows You To Take A Screenshot Of A UIView With One Line Of Code

There are a several techniques that you can use to grab a screenshot of a view on the iOS platform, and here’s a nice simple category that allows you to do it without needing to worry about grabbing the context called MLScreenshot by Marius Landwehr.

With MLScreenshot you can grab a screenshot of an image with just a single line of code.

This code from the readme shows how easily it can be done:

UIView *view = [[UIView alloc] initWithFrame:frame];
UIImage *screenshot = [view screenshot];

You can find MLScreenshot on Github here.

Thanks to Juan for the submission.

FacebookTwitterDiggStumbleUponGoogle Plus

Original article: Handy Category That Allows You To Take A Screenshot Of A UIView With One Line Of Code

©2013 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.

Leave a Reply

Your email address will not be published. Required fields are marked *