2016-05-25 62 views
1

无着色颜色的的导航栏我有UINavigationController的扩展,它设置navigationBar.tintColor,使之透明:斯威夫特

self.navigationBar.tintColor = UIColor.whiteColor() 
self.navigationBar.shadowImage = UIImage() 
self.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: .Default) 

但我想有是有一个透明的导航栏,可见项目根本没有浅色。我补充一点,有一个彩色的背景图像的右侧导航栏项目:

let rightButton = UIBarButtonItem(image: UIImage(named: "avatar")!, 
            style: UIBarButtonItemStyle.Plain, 
            target: self,  
            action: #selector(self.rightNavBarItemAction)) 

navigationItem.rightBarButtonItem = rightButton 

而是具有图像作为按钮的背景下,我得到一个白色的占位符。使用UIColor.clearColor()使按钮透明。

+0

http://stackoverflow.com/questions/17041778/uinavigationbar-set-tintcolor-tested-in-ios7-not-working尝试此链接,默认背景色调颜色是白色。 –

+0

@ManishSingh默认为蓝色 – Carpsen90

+0

尝试设置barTintColor为clearColor –

回答

0

你可以试试这个:

self.navigationController?.navigationBar.barTintColor = UIColor.green 

enter image description here

希望它为你工作。由于