Swift 设置导航栏透明,就是设置一张空的图片,但如果只设置这一句代码,并不起作用,还需要其他设置,直接上代码
// 1.设置导航栏标题属性:设置标题颜色
self.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName:UIColor.white]
// 2.设置导航栏前景色:设置item指示色
self.navigationController?.navigationBar.tintColor = UIColor.purple
// 3.设置导航栏半透明
self.navigationController?.navigationBar.isTranslucent = true
// 4.设置导航栏背景图片
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
// 5.设置导航栏阴影图片
self.navigationController?.navigationBar.shadowImage = UIImage()
原文:http://www.cnblogs.com/hkyangvip/p/5880664.html