A way to solve this problem is to add .cancelsTouchesInView = false to the UITapGestureRecognizer .
This allows you to touch other views, for example, UITableViewCell touch.
func setupGestureRecognizer() { let dismissKeyboardTap = UITapGestureRecognizer(target: self, action: "dismissKeyboard") dismissKeyboardTap.cancelsTouchesInView = false contentView.addGestureRecognizer(dismissKeyboardTap) } func dismissKeyboard() { contentView.endEditing(true) }
source share