I have a tap gesture recognizer that I use to dismiss keyboard and store some data from a textfield. On the same view I have a tableview with didSelectRowAtIndexPath. When I tap on a row my gesture recognizer gets called instead of uitableview method. I've searched stack overflow and found some obj c solutions that I tried to implement. The solution is to implement cancelsTouchesInView and set it to NO. Below is my tap gesture recognizer function that doesn't seem to work. Am I doing something wrong ?
func addTapGestureRecognizer(){
let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(detailViewController.dismissKeyboard))
self.view.addGestureRecognizer(tap)
tap.cancelsTouchesInView = false;
}
This is my didSelectRowAtIndexPath
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
print("Stisnut Redak")
let selectedRowObject = arrayForSteps[indexPath.row]
if selectedRowObject.status == false {
tableView.cellForRowAtIndexPath(indexPath)?.accessoryType = .None
} else {
tableView.cellForRowAtIndexPath(indexPath)?.accessoryType = .Checkmark
}
}