Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added accidentally omitted UIView+ImageAdditions category

  • Loading branch information...
commit 253560309cf70b1cac01fc907f5b9db347e05f72 1 parent 0a12297
George MacKerron authored
Showing with 36 additions and 0 deletions.
  1. +15 −0 UIView+ImageAdditions.h
  2. +21 −0 UIView+ImageAdditions.m
15 UIView+ImageAdditions.h
View
@@ -0,0 +1,15 @@
+//
+// UIView+ImageAdditions.h
+// https://github.com/jawj/PasscodeViewController
+//
+// Copyright (c) 2011 George MacKerron
+// Released under the MIT licence: http://opensource.org/licenses/mit-license
+//
+
+#import <QuartzCore/QuartzCore.h>
+
+@interface UIView (ImageAdditions)
+
+- (UIImage *)asUIImage;
+
+@end
21 UIView+ImageAdditions.m
View
@@ -0,0 +1,21 @@
+//
+// UIView+ImageAdditions.m
+// https://github.com/jawj/PasscodeViewController
+//
+// Copyright (c) 2011 George MacKerron
+// Released under the MIT licence: http://opensource.org/licenses/mit-license
+//
+
+#import "UIView+ImageAdditions.h"
+
+@implementation UIView (ImageAdditions)
+
+- (UIImage *)asUIImage {
+ UIGraphicsBeginImageContext(self.bounds.size);
+ [self.layer renderInContext:UIGraphicsGetCurrentContext()];
+ UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
+ UIGraphicsEndImageContext();
+ return viewImage;
+}
+
+@end
Please sign in to comment.
Something went wrong with that request. Please try again.