0

I have a cell in a UITableView with a UITextField in it and when i tap the cell the Keyboard pops up. But what I want is that the didSelectRow function gets called instead.

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)

What works is if I set the textField isUserInteractionEnabled to false but then becomeFirstResponder doesn't work anymore.

So is there any property to set so that only the didSelectRowAt functions gets called. A bit like if the allowsSelectionDuringEditing?

1 Answer 1

1

I think there are two (not clear) possible ways:

  • You can add a transparent UIView over the textField so you can't tap on it.
  • Another solution is to set the textField isUserInteractionEnabled = true after the cell selection and then set it to false in the textFieldShouldEndEditing delegate.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.