以下範例是參考做成的筆記:養成iOS8 App程式設計實力的25堂課:最新Swift開發教學
- IOS8有提供將圖片霧化的效果,如果我們將一張圖片擺進都不調整的情況下看到的結果如下
- 如果我們想把它變成這樣呢? [![](http://4.bp.blogspot.com/-qGCntfEZsMQ/VP-ziaQFhLI/AAAAAAAAEig/GI3S3yTBTK0/s320/%E8%9E%A2%E5%B9%95%E5%BF%AB%E7%85%A7%2B2015-03-11%2B%E4%B8%8A%E5%8D%8811.16.07.png)](http://4.bp.blogspot.com/-qGCntfEZsMQ/VP-ziaQFhLI/AAAAAAAAEig/GI3S3yTBTK0/s1600/%E8%9E%A2%E5%B9%95%E5%BF%AB%E7%85%A7%2B2015-03-11%2B%E4%B8%8A%E5%8D%8811.16.07.png)[![](http://1.bp.blogspot.com/-inhOmUeMfVU/VP-ztGG_pxI/AAAAAAAAEio/djWTqz97y0I/s320/%E8%9E%A2%E5%B9%95%E5%BF%AB%E7%85%A7%2B2015-03-11%2B%E4%B8%8A%E5%8D%8811.16.51.png)](http://1.bp.blogspot.com/-inhOmUeMfVU/VP-ztGG_pxI/AAAAAAAAEio/djWTqz97y0I/s1600/%E8%9E%A2%E5%B9%95%E5%BF%AB%E7%85%A7%2B2015-03-11%2B%E4%B8%8A%E5%8D%8811.16.51.png)[![](http://3.bp.blogspot.com/-NJzO9xqbdbg/VP-z3nspMII/AAAAAAAAEiw/Ud6fxww0IgI/s320/%E8%9E%A2%E5%B9%95%E5%BF%AB%E7%85%A7%2B2015-03-11%2B%E4%B8%8A%E5%8D%8811.17.30.png)](http://3.bp.blogspot.com/-NJzO9xqbdbg/VP-z3nspMII/AAAAAAAAEiw/Ud6fxww0IgI/s1600/%E8%9E%A2%E5%B9%95%E5%BF%AB%E7%85%A7%2B2015-03-11%2B%E4%B8%8A%E5%8D%8811.17.30.png)
- 程式碼撰寫如下: ```swift @IBOutlet weak var backgroundImageView: UIImageView!//背景圖 override func viewDidLoad() { super.viewDidLoad() //.Dark等於圖1 //.ExtraLight等於圖2 //.Light等於圖3 var blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Light) var blurEffectView = UIVisualEffectView(effect: blurEffect) blurEffectView.frame = view.bounds backgroundImageView.addSubview(blurEffectView) }