1234567891011121314151617181920212223242526 |
- import UIKit
- extension UIImageView {
- public func blur(withStyle style: UIBlurEffectStyle) {
- let blurEffect = UIBlurEffect(style: style)
- let blurEffectView = UIVisualEffectView(effect: blurEffect)
- blurEffectView.frame = bounds
- blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
- addSubview(blurEffectView)
- clipsToBounds = true
- }
-
- public func blurred(withStyle style: UIBlurEffectStyle) -> UIImageView {
- blur(withStyle: style)
- return self
- }
- }
|