Scroll UITextView To Bottom

后端 未结 10 1702
误落风尘
误落风尘 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 08:04

    Make a range, specifying encoding, to the last character, then scroll to that range Something other than utf8 might be appropriate depending on your content

    let range = NSMakeRange(self.OutputTextView.text.lengthOfBytes(using: String.Encoding.utf8), 0);
    self.OutputTextView.scrollRangeToVisible(range);
    

提交回复
热议问题