I have the following code in a custom UIViewController:
let tapDismissTextField = UITapGestureRecognizer(target: self, action: #selector(dismissTap)) func dismissTap() { print("Tap!") } override func viewDidLoad() { super.viewDidLoad() self.view.addGestureRecognizer(tapDismissTextField) self.friendsView.addGestureRecognizer(tapDismissTextField) } No "Tap!" lines are being printed, so the gesture recogniser isn't firing. What could be going wrong?
User Interaction Enabled is true accross all the views in this controller.
This view controller is embedded within a UINavigationController if that is of any help.
UITapGestureRecogniser, there's onlyUITapGestureRecognizer(withz, instead ofs)