I have editable UITextView that expands as I start writing into multiple rows. At some point the height of UITextView reaches predefined maximum height and becomes scrollable. While UITextView was not scrollable everything looked nice.
When text view becomes scrollable, weird thing starts happening with spellcheck underlining red dots. Details on attached image.
Can anybody help me with this? I'm sure someone has encountered it so far.
It is clearly a bug that was introduced in iOS 7 (still there for 7.0.6).
As soon as you make UITextView
scrollable, spellchecker underlines are getting mashed. If you set
textView.scrollEnabled = NO;
then it's fixed.
Solution is to put your text view into scroll view and resize scroll view's content size when text grows.
Here are some screenshots. I've also made views coloured so that you can see the bounds of all text view's subviews. Interesting that with .scrollEnabled
set to YES text is inserted in some other UIView
which height is being calculated wrong.
.scrollEnabled == YES
.scrollEnabled == NO