内容简介:Swift iOS : 模糊化
iOS的模糊化,会让界面很炫酷,用了不能停。本案例使用了FXBlurView,对图片进行模糊处理。
使用Pod文件:
target 'five' do use_frameworks! pod 'FXBlurView', '~> 1.6.4' end
然后执行pod install:
pod install --verbose --no-repo-update
如下代码可以直接编译运行:
import UIKit import FXBlurView @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { self.window = UIWindow(); self.window?.frame=UIScreen.main.bounds; self.window?.makeKeyAndVisible(); self.window?.rootViewController = Page() return true } } class Page: UIViewController { var backgroundImageView:UIImageView? var frostedView = FXBlurView() override func viewDidLoad() { super.viewDidLoad() self.backgroundImageView = UIImageView() self.backgroundImageView!.frame = self.view.frame self.backgroundImageView!.contentMode = .scaleToFill view.addSubview(self.backgroundImageView!) frostedView.underlyingView = self.backgroundImageView! frostedView.isDynamic = true frostedView.tintColor = UIColor.black frostedView.frame = self.view.frame self.view.addSubview(frostedView) self.backgroundImageView?.image = UIImage(named: "1.jpg") self.frostedView.updateAsynchronously(true, completion: nil) } }
这是我使用的图(文件名为1.jpg)记得拖放到你的工程内:

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
C++Templates中文版
David Vandevoorde、Nicolai M.Josuttis / 陈伟柱 / 人民邮电出版社 / 2008-2 / 69.00元
本书是C++模板编程的完全指南,旨在通过基本概念、常用技巧和应用实例3方面的有用资料,为读者打下C++模板知识的坚实基础。 全书共22章。第1章全面介绍了本书的内容结构和相关情况。第1部分(第2~7章)以教程的风格介绍了模板的基本概念,第2部分(第8~13章)阐述了模板的语言细节,第3部分(第14~18章)介绍了C++模板所支持的基本设计技术,第4部分(第19~22章)深入探讨了各种使用模板......一起来看看 《C++Templates中文版》 这本书的介绍吧!