swift navigationBar 透明


override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(true)
        
//       navigationController?.navigationBar.subviews[0].removeFromSuperview()//去掉NavigationBar的背景和横线
//        
//        
        navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)  //会有黑线
        
         navigationController?.navigationBar.shadowImage = UIImage()
      
    }

你可能感兴趣的:(swift navigationBar 透明)