DHSmartScreenshot 1.3.1

DHSmartScreenshot 1.3.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Feb 2015

Maintained by David Hernandez.



  • By
  • David Hernandez

UITableView/UIScrollView Category to get really easy, smart and instant screenshot images like no other library out there for iOS 5+ devices.

Screenshots

This is a tableview on the simulator:

iOS TableView on Simulator

And here is the full screenshot image that you get by selecting the first row (full screenshot image):

Screenshot Taken - Example

Installation

  1. The preferred way of installation is via Cocoapods. Just add
pod 'DHSmartScreenshot'

to your Podfile and run pod install. It will install the most recent version of DHSmartScreenshot.

Alternatively you could copy all the files in the Classes/ directory into your project. Be sure 'Copy items to destination group's folder' is checked.

Usage

  1. Import the header: #import "DHSmartScreenshot.h"

  2. Call

UIImage * tableViewScreenshot = [self.tableView screenshot];

to get a full screenshot of your tableView instance or see below to know what method to call and get a custom screenshot that better fits your needs.

Methods

There are some methods to customize the way you want to take the screenshot. Each one of them is self descriptive and works as you could expect, take a look:

- (UIImage *)screenshot;
- (UIImage *)screenshotOfCellAtIndexPath:(NSIndexPath *)indexPath;
- (UIImage *)screenshotOfHeaderViewAtSection:(NSUInteger)section;
- (UIImage *)screenshotOfFooterViewAtSection:(NSUInteger)section;
- (UIImage *)screenshotExcludingAllHeaders:(BOOL)withoutHeaders
                       excludingAllFooters:(BOOL)withoutFooters
                          excludingAllRows:(BOOL)withoutRows;
- (UIImage *)screenshotExcludingHeadersAtSections:(NSSet *)headerSections
                       excludingFootersAtSections:(NSSet *)footerSections
                        excludingRowsAtIndexPaths:(NSSet *)indexPaths;
- (UIImage *)screenshotOfHeadersAtSections:(NSSet *)headerSections
                         footersAtSections:(NSSet *)footerSections
                          rowsAtIndexPaths:(NSSet *)indexPaths;
- (UIImage *)screenshotOfVisibleContent;

Contribution

Sure :) please send a pull-request or raise an issue. It is always good to know how to make things better, yay!

Author

David Hernandez ([email protected])

License

DHSmartScreenshot is under the MIT License.