I need to implement a UINavigationBar
with a custom design, the back image needs to be changed, all the colors need to be changed and the height needs to be changed.
I know all that is possible, but I also need to change the blur effect. It needs to be a lighter blur. Is there a way of doing this without going into private APIs?
Edit: a picture of what it is supposed to look like (I know the status bar is pixelated, ignore it):
UIVisualEffectView will add translucency and blur effect on iOS 8+ views.
There are three blur UIBlurEffectStyles available.
- (void)addBlurEffect{
CGRect bounds = self.navigationController.navigationBar.bounds;
UIVisualEffectView *visualEffectView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]];
visualEffectView.frame = bounds;
visualEffectView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.navigationController.navigationBar addSubview:visualEffectView];
self.navigationController.navigationBar.backgroundColor = [UIColor clearColor];
[self.navigationController.navigationBar sendSubviewToBack:visualEffectView];
}
For more information of UIVisualEffectView
, check this question on SO.
*************** EDIT FOR iOS 7 ***************
Nicklockwood's FXBlurView came into picture for rescue for iOS5
, iOS6
, iOS7
.
I create a sample project for you which has the desired dynamic blur effect on navigation bar for iOS7. Follow the below guide to use into your project.
AppDelegate.m
blurRadius
, iterations
, tintColor
; which you must read here.Installation Guide:- https://github.com/nicklockwood/FXBlurView?source=c#installation
Full source code of FXBlurView-master
can found here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With