Get Updates By E-mail 

Article Written By:
Johann Dowa

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.


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments