美文网首页
毛玻璃背景模糊效果

毛玻璃背景模糊效果

作者: 丝丝雨凉 | 来源:发表于2017-03-25 12:19 被阅读22次

    毛玻璃效果

    先上效果图:

    let mWidth = UIScreen.main.bounds.width

    let mHieght = UIScreen.main.bounds.height

    override func viewDidLoad() {

    super.viewDidLoad()

    //模糊效果

    let lBlurEffect = UIBlurEffect(style: .light)

    let lVisualEffectView = UIVisualEffectView(effect: lBlurEffect)

    lVisualEffectView.frame = CGRect(x: 10, y: 100, width: mWidth - 20, height: (mWidth - 20) * 3 / 4)

    let lImageView = UIImageView()

    lImageView.frame = lVisualEffectView.frame

    lImageView.image = UIImage(named: "77.jpeg")

    self.view.addSubview(lImageView)

    self.view.addSubview(lVisualEffectView)

    let lSmallImageView = UIImageView()

    lSmallImageView.frame = CGRect(x: 0, y: 0, width: mWidth - 100, height: (mWidth - 100) * 3 / 4)

    lSmallImageView.center = lImageView.center

    lSmallImageView.image = UIImage(named: "77.jpeg")

    self.view.addSubview(lSmallImageView)

    相关文章

      网友评论

          本文标题:毛玻璃背景模糊效果

          本文链接:https://www.haomeiwen.com/subject/dwwbpttx.html