Created
July 6, 2015 11:15
-
-
Save vparihar01/dfb05802e567970bd7b7 to your computer and use it in GitHub Desktop.
swift Blur, Vibrant and Vibrancy
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
// Blur Effect | |
var blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Dark) | |
var blurEffectView = UIVisualEffectView(effect: blurEffect) | |
blurEffectView.frame = view.bounds | |
view.addSubview(blurEffectView) | |
// Vibrancy Effect | |
var vibrancyEffect = UIVibrancyEffect(forBlurEffect: blurEffect) | |
var vibrancyEffectView = UIVisualEffectView(effect: vibrancyEffect) | |
vibrancyEffectView.frame = view.bounds | |
// Label for vibrant text | |
var vibrantLabel = UILabel() | |
vibrantLabel.text = "Vibrant" | |
vibrantLabel.font = UIFont.systemFontOfSize(72.0) | |
vibrantLabel.sizeToFit() | |
vibrantLabel.center = view.center | |
// Add label to the vibrancy view | |
vibrancyEffectView.contentView.addSubview(vibrantLabel) | |
// Add the vibrancy view to the blur view | |
blurEffectView.contentView.addSubview(vibrancyEffectView) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment