I am trying to add action to a view which i am adding to navigation titleView
let titleview = UIView()
titleview.isUserInteractionEnabled = true
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(VC.openPopup))
titleview.addGestureRecognizer(tapGesture)
let label = UILabel()
label.textColor = UIColor.white
label.font = UIFont.systemFont(ofSize: 12)
label.text = "Tap Here to change"
titleview.addSubview(self.selectGroupButton)
titleview.addSubview(label)
I am adding this view as navigation titleView
self.navigationItem.titleView = self.selectGroupView
self.navigationItem.titleView?.isUserInteractionEnabled = true
But my method is not being called.