Skip to content

Instantly share code, notes, and snippets.

@matthiasplappert
Last active August 29, 2015 13:57
Show Gist options
  • Save matthiasplappert/9493050 to your computer and use it in GitHub Desktop.
Save matthiasplappert/9493050 to your computer and use it in GitHub Desktop.

Revisions

  1. matthiasplappert revised this gist Mar 11, 2014. 1 changed file with 3 additions and 4 deletions.
    7 changes: 3 additions & 4 deletions gistfile1.m
    Original file line number Diff line number Diff line change
    @@ -4,13 +4,12 @@ @interface UIView (MPAdditions)
    @implementation UIView (MPAdditions)

    - (id)debugQuickLookObject {
    CGSize size = self.bounds.size;
    if (size.width < 0.0f || size.height < 0.0f) {
    if (self.bounds.size.width < 0.0f || self.bounds.size.height < 0.0f) {
    return nil;
    }

    UIGraphicsBeginImageContextWithOptions(size, NO, self.window.screen.scale);
    [self drawViewHierarchyInRect:CGRectMake(0.0f, 0.0f, size.width, size.height) afterScreenUpdates:YES];
    UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, self.window.screen.scale);
    [self drawViewHierarchyInRect:self.bounds afterScreenUpdates:YES];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

  2. matthiasplappert revised this gist Mar 11, 2014. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions gistfile1.m
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,9 @@ @implementation UIView (MPAdditions)

    - (id)debugQuickLookObject {
    CGSize size = self.bounds.size;
    if (size.width < 0.0f || size.height < 0.0f) {
    return nil;
    }

    UIGraphicsBeginImageContextWithOptions(size, NO, self.window.screen.scale);
    [self drawViewHierarchyInRect:CGRectMake(0.0f, 0.0f, size.width, size.height) afterScreenUpdates:YES];
  3. matthiasplappert created this gist Mar 11, 2014.
    17 changes: 17 additions & 0 deletions gistfile1.m
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    @interface UIView (MPAdditions)
    @end

    @implementation UIView (MPAdditions)

    - (id)debugQuickLookObject {
    CGSize size = self.bounds.size;

    UIGraphicsBeginImageContextWithOptions(size, NO, self.window.screen.scale);
    [self drawViewHierarchyInRect:CGRectMake(0.0f, 0.0f, size.width, size.height) afterScreenUpdates:YES];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    return image;
    }

    @end