I have this editable text view inside a table view cell, maximumNumberOfLines
is set to 4 and lineBreakMode
to byClipping
. This works pretty much as intended, however it seems you can type past the width of the text view, like so:
Although the characters are not visible they are being stored somewhere, because in order to get back to visible text, deleting as much as you typed outside the bounds is necessary.
I am struggling to find something unique about these invisible characters, so that a simple deleteBackward()
does the job inside an if statement. This way, the user cannot physically type past the bounds of the text view.
What is something about these invisible characters I can identify in textView:shouldChangeTextIn
, so I deleteBackwards()
and invalidate the type?