如何解决在快速导航栏的透明度?

我有一个透明的导航栏与视图控制器的背景图像,但是当我添加一个酒吧button项导航栏,就像在第二个图片。 我如何有酒吧button项目也完全透明的导航栏。

我使用下面的代码来使导航栏透明。

extension UINavigationController { public func presentTransparentNavigationBar() { navigationBar.setBackgroundImage(UIImage(), forBarMetrics:UIBarMetrics.Default) navigationBar.translucent = true navigationBar.shadowImage = UIImage() setNavigationBarHidden(false, animated:true) } public func hideTransparentNavigationBar() { setNavigationBarHidden(true, animated:false) navigationBar.setBackgroundImage(UINavigationBar.appearance().backgroundImageForBarMetrics(UIBarMetrics.Default), forBarMetrics:UIBarMetrics.Default) navigationBar.translucent = UINavigationBar.appearance().translucent navigationBar.shadowImage = UINavigationBar.appearance().shadowImage } } 

这应该创build一个透明的UINavigationBar中的项目。 目前它对我很好。

  let navigationBarAppearace = UINavigationBar.appearance() navigationBarAppearace.tintColor = UIColor.whiteColor() navigationBarAppearace.translucent = true navigationBarAppearace.shadowImage = UIImage() navigationBarAppearace.backgroundColor = UIColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.0) navigationBarAppearace.titleTextAttributes = [NSForegroundColorAttributeName : UIColor.whiteColor()] navigationBarAppearace.setBackgroundImage(UIImage(), forBarMetrics: .Default) 

尝试:

 if let navBar = self.navigationController?.navigationBar { extendedLayoutIncludesOpaqueBars = true navigationBar.translucent = true navigationBar.backgroundColor = UIColor.clearColor() navigationBar.setBackgroundImage(UIImage(), forBarMetrics: .Default) navigationBar.shadowImage = UIImage() }