我有一个blueView,我想覆盖导航栏中的大标题区域(Fav10)。但是我无法访问它。将navBar的topItem.titleView设置为blueView只会给我2个标题。我该如何自定义该区域?
override func viewDidLoad() {
super.viewDidLoad()
setupNavBar()
}
private func setupNavBar() {
navigationItem.title = "Fav 10"
let blueView = UIView()
blueView.backgroundColor = .blue
blueView.frame.size = CGSize(width: 40, height: 40)
navigationController?.navigationBar.isTranslucent = false
navigationController?.navigationBar.topItem!.titleView = blueView
navigationController?.navigationBar.prefersLargeTitles = true
}