设置navigationBar的全透明,但是push到其他页面后,页面也变成了全透明,
解决:为了不影响其他也面的显示,设置如下:
//MARK: View LifeCycle
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
//设置背景色透明
navigationController?.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default)
//清除navibar的下划线
navigationController?.navigationBar.shadowImage = UIImage()
}
override func viewWillDisappear(animated: Bool) {
super.viewWillDisappear(animated)
//设置背景色透明
navigationController?.navigationBar.setBackgroundImage(nil , forBarMetrics: UIBarMetrics.Default)
//清除navibar的下划线
navigationController?.navigationBar.shadowImage = UIImage()
}
解决:为了不影响其他也面的显示,设置如下:
//MARK: View LifeCycle
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
//设置背景色透明
navigationController?.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default)
//清除navibar的下划线
navigationController?.navigationBar.shadowImage = UIImage()
}
override func viewWillDisappear(animated: Bool) {
super.viewWillDisappear(animated)
//设置背景色透明
navigationController?.navigationBar.setBackgroundImage(nil , forBarMetrics: UIBarMetrics.Default)
//清除navibar的下划线
navigationController?.navigationBar.shadowImage = UIImage()
}