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.
- Look into
AppDelegate.m
- Here I add the background image to the navigation bar. You can update the image in any viewcontroller to achieve the dynamic blur background image on navigation bar.
- There are few FXblurview properties like
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.