I was trying to figure out a way to set the cursor to the bottom of a long UITextView with animation. The setup was not too complicated; in fact, this answer covers it very well. stack overflow
However, reviving it is not so simple. I can not find setSelectedTextRange(animated:) . Installing it inside a UIView.animate... block seems to do nothing. The best I could come up with was to animate the scroll manually, and then set selectedTextRange at the end. However, it is fragile, often looks volatile and, sometimes, sometimes does not work.
When you set selectedTextRange , it goes to that place. If there was a way to avoid this transition, the animation could be smoother and at least be less fragile as it would not require a delay and you could use setContentOffset(animated) without waiting to set selectedTextRange .
Another option is to find a way to make the selectedTextRange animation animate. On this front, I tried the trick of disabling scrolling before and re-enabling after, but that didn't seem to work for me. Guess what changed in later versions of iOS.
ios animation swift uitextview
Ryan Poolos Jul 20 '17 at 13:29 2017-07-20 13:29
source share