func navBarItebTitleView(value: [String: AnyObject]) {
let titleView = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 40))
titleView.backgroundColor = UIColor.brown
let container = UIView()
container.translatesAutoresizingMaskIntoConstraints = false
container.backgroundColor = UIColor.red
titleView.addSubview(container)
container.centerXAnchor.constraint(equalTo: titleView.centerXAnchor).isActive = true
container.centerYAnchor.constraint(equalTo: titleView.centerYAnchor).isActive = true
container.widthAnchor.constraint(equalToConstant: 40).isActive = true
container.heightAnchor.constraint(equalToConstant: 40).isActive = true
navigationItem.titleView = titleView
titleView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(showChatController)))
}
Почему когда я пытаюсь создать кастомный navigationItem.titleView , titleView из кода не отображается, отображается только Conteiner, и все элементы что он содержит, соответственно не работает переход при распознании жеста?!
В showChatController просто пушится новый контроллер с navBar