UITableView Category to get really easy, smart and instant screenshot images like no other library out there for iOS 5+ devices.
This is a tableview on the simulator:
And here is the full screenshot image that you get by selecting the first row (full screenshot image):
- 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.
-
Import the header:
#import "DHSmartScreenshot.h"
-
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.
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;
Sure :) please send a pull-request or raise an issue. It is always good to know how to make things better, yay!
David Hernandez (dav.viidd94@gmail.com)
DHSmartScreenshot is under the MIT License.