@interface UIView (MPAdditions) @end @implementation UIView (MPAdditions) - (id)debugQuickLookObject { if (self.bounds.size.width < 0.0f || self.bounds.size.height < 0.0f) { return nil; } UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, self.window.screen.scale); [self drawViewHierarchyInRect:self.bounds afterScreenUpdates:YES]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return image; } @end