在iOS上以切换模式模糊应用程序屏幕[复制]

参见英文答案 > Controlling the screenshot in the iOS 7 multitasking switcher8个
我希望在切换时在我的iOS应用中使用模糊效果.像PayPal和其他一些需要隐藏信息的金融应用程序.但我找不到有关此功能的任何信息或提示.

例如PayPal实现:http://40.media.tumblr.com/0334b065e28dfe2e325d32822d87246b/tumblr_mwcl35TZIt1qea4hso1_1280.jpg

解决方法

您需要将以下代码添加到applicationWillResignActive函数
let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Dark)
    let blurEffectView = UIVisualEffectView(effect: blurEffect)
    blurEffectView.frame = window!.frame
    blurEffectView.tag = 221122

    self.window?.addSubview(blurEffectView)

然后在您的applicationWillEnterForeground中,使用该行

self.window?.viewWithTag(221122)?.removeFromSuperview()

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...