Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. func addBlurEffect() {
  2. // Add blur view
  3. let bounds = self.navigationController?.navigationBar.bounds as CGRect!
  4. let visualEffectView = UIVisualEffectView(effect: UIBlurEffect(style: .light))
  5. visualEffectView.frame = bounds!
  6. visualEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
  7. self.navigationController?.navigationBar.addSubview(visualEffectView)
  8. self.navigationController?.navigationBar.sendSubview(toBack: visualEffectView)
  9. visualEffectView.isUserInteractionEnabled = false
  10. }
  11.  
  12. bounds.offsetBy(dx: 0.0, dy: -20.0)
  13. bounds.size.height = bounds.height + 20.0
  14.  
  15. [[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc]init] forBarMetrics:UIBarMetricsDefault];
  16. [[UINavigationBar appearance] setShadowImage:[[UIImage alloc]init]];
  17. [[UINavigationBar appearance] setBackgroundColor:[UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.0f]];
  18. [[UINavigationBar appearance] setTranslucent:YES];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement