On double clicking home button, we will be able to view the app screenshot in phone. Can we blur this screenshot? Is it possible?
-
The duplicate is written in objective-c but it's a possible duplicate of [Controlling the screenshot in the iOS 7 multitasking switcher](http://stackoverflow.com/questions/18959411/controlling-the-screenshot-in-the-ios-7-multitasking-switcher) – Black Frog Apr 23 '15 at 20:29
2 Answers
Yes we can do it. I do it in my application in a different fashion by showing it all black. When the application goes to background add your blur image to window and when your app comes to foreground or didBecomeActive remove the blur image from window
This is how you can take snapshot of current screen below:
UIGraphicsBeginImageContext (CGSizeMake(view.frame.size.width, view.frame.size.height));
[view drawViewHierarchyInRect:CGRectMake(0, 0, view.frame.size.width, view.frame.size.height) afterScreenUpdates:YES];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
There is already a category provided by apple called UIImage + imageeffects which gives below methods: 1. applyLightEffect 2. applyExtraLightEffect 3. applyDarkEffect 4. applyTintEffectWithColor: 5.applyBlurWithRadius:tintColor:saturationDeltaFactor:maskImage:
You can use any of the move to apply blur effect.
[[[UIApplication sharedApplication] keyWindow] addSubview:<your image>]

- 2,628
- 1
- 20
- 37
From iOS8, the method you are looking for to blur the screen is applyLightEffect
which you apply to an image you want to blur
- you can make an image out of your entire view and apply blur effect when the user enters background, then revert it to the normal state (for example delete that image) when the app goes into foreground again.
For more informations about how to create an image from your view and apply a blur, please check out this post from Jeremy Fox: https://stackoverflow.com/a/17138341/1938719