Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Differences between `.EditingDidEnd` and `.EditingDidEndOnExit`

What exactly are the differences between the UIControlEvents .EditingDidEnd and .EditingDidEndOnExit, and how do they relate to each other?

The documentation on UIControl is pretty vague, and has no information of whether these fire for different reasons, if one is a superset of the other, or if they're functionally equivalent.

The possibility of one being a superset is especially confusing, since the naming implies that .EditingDidEndOnExit is a specific occurrence of .EditingDidEnd, but the documentation seems to imply the opposite.

like image 594
Kazmasaurus Avatar asked Feb 18 '15 19:02

Kazmasaurus


2 Answers

".EditingDidEnd" is called when somebody touches outside of the bounds of the text field, because they're likely about to interact with some other control or object.

"EditingDidEndOnExit" is called when the user clicks the "return" key in the keyboard (and you're right, it's not clear in the documentation... but if you look at the UIControl.h file you'll see a comment reflecting this point).

like image 86
Michael Dautermann Avatar answered Nov 11 '22 17:11

Michael Dautermann


From the UIControl header:

UIControlEventEditingDidEnd       = 1 << 18,
UIControlEventEditingDidEndOnExit = 1 << 19,     // 'return key' ending editing

So one is when the return key was pressed, the other is from touching outside of the bounds.

like image 23
Logan Avatar answered Nov 11 '22 17:11

Logan