I have a UITableView with static cells and grouped style in my UIViewController. I added a UIGestureRecognizer, that I can dismiss the Keyboard, but I want to except the UIGestureRecognizer for several UITableViewCells, because they have a functionality when they get selected.
My code:
The class - variable that I can use it everywhere in the code:
var tap:UITapGestureRecognizer = UITapGestureRecognizer()
My viewDidLoad() Method:
override func viewDidLoad() {
super.viewDidLoad()
self.tap = UITapGestureRecognizer(target: self, action: "DismissKeyboard")
tableView.addGestureRecognizer(tap)
}
And the Action of the UIGestureRecognizer:
func DismissKeyboard()
{
print("is here")
if(self.keyboardIsVisible)
{
view.endEditing(true)
self.refreshTableView()
}
}
I removed the Gesture Recognizer of one cell in the override func cellForRowAtIndexPath:
cell.removeGestureRecognizer(self.tap)
But when I tap this cell it still goes into the DismissKeyboard - Action...