From c773c812af6c8270bae1eebf85bb01dad5a590e0 Mon Sep 17 00:00:00 2001 From: Heiko Guckes Date: Fri, 11 Sep 2015 15:24:15 +0200 Subject: [PATCH] Use drawViewHierarchyinRect when applicable to increase performance and avoid crashing issues in iOS 9 --- src/Blur/MRBlurView.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Blur/MRBlurView.m b/src/Blur/MRBlurView.m index 5b72b6d..579572a 100644 --- a/src/Blur/MRBlurView.m +++ b/src/Blur/MRBlurView.m @@ -182,7 +182,11 @@ - (UIImage *)snapshot { CGContextTranslateCTM(context, -origin.x, -origin.y); // Draw the window - [window.layer renderInContext:context]; + if ([window respondsToSelector:@selector(drawViewHierarchyInRect:afterScreenUpdates:)]) { + [window drawViewHierarchyInRect:window.bounds afterScreenUpdates:YES]; + } else { + [window.layer renderInContext:context]; + } // Capture the image and exit context UIImage *image = UIGraphicsGetImageFromCurrentImageContext();