Delete (not Backspace) does not trigger UITextViewDelegate shouldChangeTextInRange
When using an external keyboard, my UITextView
message shouldChangeTextInRange
is triggered very simply when I press the Backspace key, but if I press Delete ("forward delete"), the method will never be generally speaking, despite changing the overview text. as was expected. In case it matters, I am using Swift and the latest iOS simulator.
If this is the expected behavior, can someone point me to the documentation that explains this?
More importantly, is there a workaround?
Edit: posted rdar: // 18909378. I also found the same behavior when using cmd + backspace and opt + backspace. Very annoying!
source to share
I can still see this issue on iOS 10. The best workaround I have come up with is listening for the event UIControlEventEditingChanged
and capturing textField.text
from there. This gives you updated content, but does not prevent a delete action from being prevented for example shouldChangeCharactersInRange
.
source to share