Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blurring app screen in switch mode on iOS [duplicate]

Tags:

ios

onblur

I want to use blurring in my iOS app when it switch. Like PayPal and some other financial app where need to hide information. But I can't find any information or hint about this feature.

For example PayPal realization: http://40.media.tumblr.com/0334b065e28dfe2e325d32822d87246b/tumblr_mwcl35TZIt1qea4hso1_1280.jpg

like image 498
Sul Tan Avatar asked Aug 13 '15 07:08

Sul Tan


People also ask

What is Blur snapshot on iOS app switcher?

If you don't want any of your Zoom information to be exposed while switching between multiple apps open on your iOS device, you can enable Blur snapshot on iOS app switcher. This setting blurs the Zoom app preview screen in the iOS task switcher when multiple apps are open.

How do you blur a view in iOS Swift?

You will need to create the blur effect using the UIBlurEffect Class in the viewDidLoad method. After that you'll need to apply the effect to the UIVisualEffectView. The UIVisualEffectView needs to have the container dimensions defined, and it will be the first view of the stack of the view controller.


1 Answers

You need to add the following code to your applicationWillResignActive function

    let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Dark)
    let blurEffectView = UIVisualEffectView(effect: blurEffect)
    blurEffectView.frame = window!.frame
    blurEffectView.tag = 221122

    self.window?.addSubview(blurEffectView)

Then in your applicationDidBecomeActive, use the line

self.window?.viewWithTag(221122)?.removeFromSuperview()
like image 99
Shamas S Avatar answered Sep 30 '22 18:09

Shamas S