Scroll UITextView To Bottom

后端 未结 10 1672
误落风尘
误落风尘 2020-12-08 07:26

I am making a an app that has a UITextView and a button.

When I click the button some text will add in the UITextView.

But when c

10条回答
  •  失恋的感觉
    2020-12-08 07:55

    textView.scrollRangeToVisible(NSRange(..

    This solution does a couple of notable things slightly different:

    • Utilizes the String.Index interface (likely more performant than e.g. .count)
    • Uses a PartialRangeUpTo which avoids an explicit range start position, reducing the code to a clean one-liner

提交回复
热议问题