UITextView in iOS7 clips the last line of text string

后端 未结 11 1292
轻奢々
轻奢々 2020-12-04 09:30

UITextView in iOS7 has been really weird. As you type and are entering the last line of your UITextView, the scroll view doesn\'t scroll to the bottom like it should and it

11条回答
  •  感动是毒
    2020-12-04 09:47

    The solution I found here was to add a one line fix after you create a UITextView:

    self.textview.layoutManager.allowsNonContiguousLayout = NO;
    

    This one line fixed three issues I had creating a UITextView-based code editor with syntax highlighting on iOS7:

    1. Scrolling to keep text in view when editing (the issue of this post)
    2. UITextView occasionally jumping around after dismissing the keyboard
    3. UITextView random scrolling jumps when trying to scroll the view

    Note, I did resize the whole UITextView when the keyboard is shown/hidden.

提交回复
热议问题