我的场景,我正在尝试实现当前模型从VC_A到VC_B的ViewController过渡。在这里,我已将VC_B嵌入到Navigation-controller中,但导航控制器未在操作前显示(我的意思是没有条形颜色)。该如何解决?
let cropViewController = self.storyboard!.instantiateViewController(withIdentifier: "cropviewcontroller") as! DDCropViewController
cropViewController.delegate = self
cropViewController.image = image
cropViewController.pointSize = CGSize(width: 40, height: 40)
let navController = UINavigationController(rootViewController: cropViewController)
self.present(navController, animated:true, completion: nil)
答案 0 :(得分:0)
在presentedViewController(此处为VC_B)viewWillApear方法的行下面写
self.navigationController?.navigationBar.barTintColor = UIColor.black //AnyColorYouWant
希望有帮助!
答案 1 :(得分:0)
以下代码可以正常工作。
// MARK: Navigation Bar Color Apply
UINavigationBar.appearance().barTintColor = #colorLiteral
UINavigationBar.appearance().tintColor = #colorLiteral
UINavigationBar.appearance().titleTextAttributes =[NSAttributedString.Key.foregroundColor : UIColor.white]