Gentlemen, how to make the Navigation Bar and Status Bar blurred (UIBlurEffect)? When I click on the picture I scroll down (Scroll View) to other pictures, this picture (in this case with a white car) is simply lost under the Navigation Bar, and I need this picture to be visible under the Navigation Bar with the UIBlurEffect effect.
I tried it, but it did not work:
func addBlurEffect() { // Add blur view let bounds = self.navigationController?.navigationBar.bounds as CGRect! let visualEffectView = UIVisualEffectView(effect: UIBlurEffect(style: .light)) visualEffectView.frame = bounds! visualEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight] self.navigationController?.navigationBar.addSubview(visualEffectView) self.navigationController?.navigationBar.sendSubview(toBack: visualEffectView) visualEffectView.isUserInteractionEnabled = false } First, when scrolling, the picture also disappears under the Navigation Bar.
Secondly, the Status Bar remained gray.
In order for the Status Bar to NOT remain gray, I tried to do it, but to no avail = (
bounds.offsetBy(dx: 0.0, dy: -20.0) bounds.size.height = bounds.height + 20.0 Also in AppDelegate (it is written in Objective-C in the application) in didFinishLaunchingWithOptions, I tried to add it, everything remained the same unchanged:
[[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc]init] forBarMetrics:UIBarMetricsDefault]; [[UINavigationBar appearance] setShadowImage:[[UIImage alloc]init]]; [[UINavigationBar appearance] setBackgroundColor:[UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.0f]]; [[UINavigationBar appearance] setTranslucent:YES]; Please help solve the problem, I have been driving with it for 2 days already.