我在UINavigationBar
上添加了两个按钮。我能够成功呈现导航控制器但不添加按钮。
let secondVC = self.storyboard?.instantiateViewController(withIdentifier: "FilterViewController") as! FilterViewController
let navigationVC = UINavigationController(rootViewController: secondVC)
navigationVC.navigationBar.tintColor = UIColor.red
navigationVC.navigationBar.topItem?.title = "some title"
navigationVC.navigationBar.isTranslucent = false
let add = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(dismissFilterView))
let play = UIBarButtonItem(title: "Play", style: .plain, target: self, action: #selector(dismissFilterView))
navigationVC.navigationItem.rightBarButtonItems = [add, play]
self.present(navigationVC, animated: true, completion: nil)