I am trying to add a blur effect to the navigation bar and status bar. My problem is that blurring works great for the navigation bar, but the status bar doesn't blur.
My question is: how can I expand the boundaries to cover the status bar?
I use the following method to create a blur effect:
- (void) addBlurEffect { CGRect bounds = self.navigationController.navigationBar.bounds; UIVisualEffectView *visualEffectView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]]; visualEffectView.frame = bounds; visualEffectView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; [self.navigationController.navigationBar addSubview:visualEffectView]; self.navigationController.navigationBar.backgroundColor = [UIColor clearColor]; [self.navigationController.navigationBar sendSubviewToBack:visualEffectView];
}
In my plist, I have the appearance of a line in the View YES control panel
In viewDidLoad, I call the method:
- (void)configureView { // style controls self.addAirportButton.tintColor = [UIColor whiteColor]; // style background image UIImageView *sidebarBackground = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"sidebarBackground"]]; self.tableView.backgroundView = sidebarBackground; // style navigation bar self.navigationController.navigationBar.barStyle = UIStatusBarStyleLightContent; // this makes navigation bar transparent [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; self.navigationController.navigationBar.shadowImage = [UIImage new]; self.navigationController.navigationBar.translucent = YES; // style toolbar self.navigationController.toolbar.translucent = YES; self.dismissAdsButton.tintColor = [UIColor whiteColor];
Nothing important is done in viewDidLoad. When I create this, this is what the view looks like - this is the tableViewController built into the NavigationController, and I also use the excellent SWRevealViewController.
See how the status bar is not blurred:

Any help would be really appreciated!
UPDATE:
See answer below. Here is a screenshot of the implemented solution:

source share