2

I use this code to blur navigation bar:

let visualEffectView   = UIVisualEffectView(effect: UIBlurEffect(style: .light))
visualEffectView.frame =  (self.navigationController?.navigationBar.bounds.insetBy(dx: 0, dy: -10).offsetBy(dx: 0, dy: -10))!
self.navigationController?.navigationBar.isTranslucent = true
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
self.navigationController?.navigationBar.addSubview(visualEffectView)
self.navigationController?.navigationBar.sendSubview(toBack: visualEffectView)

But my back button doesn't work and other button doesn't appear. How to fix it?

Donald Duck
  • 8,409
  • 22
  • 75
  • 99
  • @AnuragSharma [Please stop abusing code formatting.](https://meta.stackexchange.com/q/135112/349538) – Donald Duck Sep 05 '17 at 11:57
  • @DonaldDuck Thank you! for telling me about code formatting. But sometimes many keywords are in the code of the OP itself. I just highlighted them. Point me out if I did any wrong code formatting except that. – Anurag Sharma Sep 05 '17 at 12:13
  • @AnuragSharma You should not format keywords as code just because they're keywords. Code formatting is only for code (variable names, function names, class names, etc) or for code-like artifacts (file names, commands, etc). Code formatting should *not* be used to highlight keywords, names of programming languages, etc. Keywords usually don't need to be highlighted at all, but if it's really necessary, use bold or italics. You may be interested in these posts on Meta: https://meta.stackexchange.com/q/135112/349538 and https://meta.stackoverflow.com/q/355183/4284627. – Donald Duck Sep 05 '17 at 12:50

1 Answers1

4

Just you should disable "isUserInteractionEnabled" to your visualEffectView

add the following line:

 visualEffectView.layer.zPosition = -1;
    visualEffectView.isUserInteractionEnabled = false
Abdelahad Darwish
  • 5,969
  • 1
  • 17
  • 35