Add blur effect in iOS with custom blur intensity to your uiview, uilabels, uiimages etc etc
Low to high intensity
To use just download and include TSBlurEffectView.swift into your project and write an extension for UILabel as follow
Write an extension for UILabel as follow
extension UILabel {
func addBlurrEffect() {
let blurEffectView = TSBlurEffectView() // creating a blur effect view
blurEffectView.intensity = 1 // setting blur intensity from 0.1 to 10
self.addSubview(blurEffectView) // adding blur effect view as a subview to your view in which you want to use
}
func removeBlurEffect() {
for subview in self.subviews {
if subview is UIVisualEffectView {
subview.removeFromSuperview()
}
}
}
}
For adding yourUILable.addBlurrEffect() for adding blur effect
And yourUILable.removeBlurEffect() for removing the blur effect
To use just download and include TSBlurEffectView.swift into your project and write an extension for UILabel as follow
extension UIView {
func addBlurrEffect() {
let blurEffectView = TSBlurEffectView() // creating a blur effect view
blurEffectView.intensity = 1 // setting blur intensity from 0.1 to 10
self.addSubview(blurEffectView) // adding blur effect view as a subview to your view in which you want to use
}
func removeBlurEffect() {
for subview in self.subviews {
if subview is UIVisualEffectView {
subview.removeFromSuperview()
}
}
}
}
For adding yourUIView.addBlurrEffect() for adding blur effect
And yourUIView.removeBlurEffect() for removing the blur effect
To use just download and include TSBlurEffectView.swift into your project and write an extension for UILabel as follow
extension UIImageView {
func addBlurrEffect() {
let blurEffectView = TSBlurEffectView() // creating a blur effect view
blurEffectView.intensity = 1 // setting blur intensity from 0.1 to 10
self.addSubview(blurEffectView) // adding blur effect view as a subview to your view in which you want to use
}
func removeBlurEffect() {
for subview in self.subviews {
if subview is UIVisualEffectView {
subview.removeFromSuperview()
}
}
}
}
For adding yourUIImageView.addBlurrEffect() for adding blur effect
And yourUIImageView.removeBlurEffect() for removing the blur effect
You can add it to any UIView directly as well.