UIView background too blurry
I am trying to make a UIView (Genres) have a blurry background. I have tried this code. But it is too blurry:
_Genres.opaque = NO; _Genres.backgroundColor = [UIColor clearColor]; UIToolbar *fakeToolbar = [[UIToolbar alloc] initWithFrame:_Genres.bounds]; fakeToolbar.autoresizingMask = _Genres.autoresizingMask; [_Genres insertSubview:fakeToolbar atIndex:0];
So I tried this:
_Genres.alpha = 0.9;
But this just makes it see through not less blurry.
The UIView also needs a "live blur".
These are two images. The first one is the actual toolbar (which I want it to be like) and the second one is using the code above. They have both been taken over the same background.
As you can see underneath the toolbar the blur is a lot less intense.
How can I make it more like the original toolbar?
You want FXBlurView: https://github.com/nicklockwood/FXBlurView. If you need blur to be live set dynamic = YES.
Otherwise it just behaves as a UIView but blurs the stuff behind it
If you are targeting iOS 7 and above, I believe that this article might be of help to you: http://www.raywenderlich.com/60968/ios-7-blur-effects-gpuimage
The author uses new iOS 7 API to create blurs that will look in place in iOS 7. And the great part is that by changing one line of code, you will be able to experiment with other different types of blur.
Don't even try to use UIToolbar for blur on iOS 7 unless you have some super special need for the so-called 'live blur'. Other than that I recommend you Apple's own UIImage extension. Check it out here:
Import it in your .m file:
Then use on UIImage it like this:
[ourImage applyBlurWithRadius:10 tintColor:[[UIColor blackColor] colorWithAlphaComponent:0.5] saturationDeltaFactor:0.0 maskImage:nil];
With this you can achieve better and faster effects with a ton of customization for your needs.
Also in iOS 8 it will be much easier, you can simply use UIVisualEffectView