ide / UIVisualEffects

Learn how to use UIVisualEffectViews with UIBlurEffect and UIVibrancyEffect in iOS 8 and up
MIT License
426 stars 25 forks source link

Cancel Vibrancy #1

Closed MP0w closed 10 years ago

MP0w commented 10 years ago

I can't get it working if not masking a view with a label, can you explain me better how your solution worked?

ide commented 10 years ago

Apple changed UIVisualEffectView between iOS 8 beta 1 and beta 5, and removed this functionality. It was never documented but I thought it looked cool and potentially useful. I can no longer get it to work and will update the README.

In case you wanted to know, my approach looked like:

let roundRectImage = UIImage(named: "FilledRoundRect")
let roundRectImageView = UIImageView(image: roundRectImage)
roundRectImageView.center = lightVibrancyView.convertPoint(lightVibrancyView.center, fromView: lightVibrancyView.superview)
lightVibrancyView.contentView.addSubview(roundRectImageView)

let nonVibrantLabel = UILabel()
nonVibrantLabel.textColor = UIColor.whiteColor()
nonVibrantLabel.text = "Text"
nonVibrantLabel.sizeToFit()
nonVibrantLabel.center = roundRectImageView.center
lightVibrancyView.contentView.addSubview(nonVibrantLabel)

FilledRoundRect is a simple image here.