Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (20 sloc) 0.63 kB
//
// UIView+ImageCapture.m
// Frank
//
// Created by Pete Hodgson on 7/26/12.
// Copyright (c) 2012 Thoughtworks. All rights reserved.
//
#import "UIView+ImageCapture.h"
#import <QuartzCore/QuartzCore.h>
@implementation UIView (ImageCapture)
- (UIImage *)captureImage {
CGFloat scale = [UIScreen mainScreen].scale;
CGSize size = self.bounds.size;
UIGraphicsBeginImageContextWithOptions(size, NO, scale);
[self.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
@end
Jump to Line
Something went wrong with that request. Please try again.