Why is the testFieldDidChangeSelection function called three times when the return key is pressed?
Here is what I did
- enter text in TextField
- press the Return key
The result is that the textFieldDidChangeSelection function is called three times.
I would like to know why.
As a supplement, I asked ChatGPT and the results are below.
- At the moment the Return key is pressed: The cursor is updated at the position of the last character entered in the text field.
- Insertion of a newline: When the Return key is pressed, a new line is added, and the cursor moves to the beginning of the new line.
- Finalization of the edit: Finally, the content of the text field is confirmed, and the position of the cursor is finalized.
Also, is the above answer true?