There seems to be lots on this subject. But I couldn't get any of the solutions to work.
My code creates a tableView
full of cells with varying contents (based on a JSON), the user should enter the info in each cell. The problem I am having is, when the user taps somewhere outside the cell (i.e. on the tableView
background) I want the keyboard to dismiss.
didSelectRowAtIndexPath:
method is not good.
touchesBegan:
does not fire at all (tableView
has user interaction enabled, but I assume there is some other reason).
I have added a gesture to the tableView
, but then I cannot start editing.
I know the resignFirstResponder
. But I don't know which field is being edited. so I think, I need to go with the endEditing:
method. But I just couldn't get it called, when user touches outside of a cell.
Any help would appreciated.