1、直接设置背景色 self.navigationBar.barTintColor = MainColor
2、self.navigationBar.backgroundImage(for: <#T##UIBarMetrics#>)
3、添加一个UIView let barBgView = GradientColorBgView(frame: CGRect(x: 0, y: 0, width: UIScreen_Width, height: 64)) self.navigationBar.subviews.first?.addSubview(barBgView)