Last active
August 11, 2020 21:24
-
-
Save bitops/cb11ff24cb72bd37a6b04e432e1161fe to your computer and use it in GitHub Desktop.
UIViewController that frosts a portion of the screen. The `toggleBlur` method is hooked up to a button on the story board.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BlurViewController: UIViewController { | |
var blurView : UIVisualEffectView! | |
override func viewDidLoad() { | |
let frame = CGRect(x: view.bounds.maxX * 0.1, y: view.bounds.maxY * 0.4, width: 350, height: 200) | |
blurView = UIVisualEffectView(frame: frame) | |
blurView.effect = UIBlurEffect(style: .systemUltraThinMaterial) | |
view.addSubview(blurView) | |
} | |
@IBAction func toggleBlur() { | |
blurView.isHidden = !blurView.isHidden | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment