Skip to content

Dynamic blur for UIView using UIVisualEffectView

Notifications You must be signed in to change notification settings

xpams/UIView-Blur

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UIView-Blur

Dynamic blur for UIView using UIVisualEffectView

  1. Put a transparent UIView over the elements that you need to blur (button, text field, etc.)
  2. Then initialize blur view:
import UIKit

class ViewController: UIViewController {
    
    @IBOutlet weak var viewForBlur: UIView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.viewForBlur.isUserInteractionEnabled = false;
        _ = self.viewForBlur.blurView.setup(style: .light, intensity: 0);
    }
    
}
  1. At any time you can change the blur intensity:
@IBAction func valueChanged(_ sender: Any) {
    self.viewForBlur.blurView.intensity = CGFloat((sender as! UISlider).value);
}

Video Preview (Youtube) IMAGE ALT TEXT HERE

About

Dynamic blur for UIView using UIVisualEffectView

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages