Scroll to correct position
alexsteinerde opened this issue · 1 comments
alexsteinerde commented
This function should not scroll to the end or to the top. It should scroll to the cursor position.
I added a workaround for myself:
func textViewDidChangeHeight(_ textView: GrowingTextView, height: CGFloat) {
UIView.setAnimationsEnabled(false)
let caret = tableView.convert(textView.caretRect(for: textView.selectedTextRange!.start), from: textView)
let keyboardTopBorder = textView.bounds.size.height - tableView.frame.width
if caret.origin.y > keyboardTopBorder && textView.isFirstResponder {
tableView.scrollRectToVisible(caret, animated: true)
}
UIView.setAnimationsEnabled(true)
}
KennethTsang commented
Thanks for the suggestion. I believe in some case users still expect scroll to the end or the top (at least in my case). Maybe I will add this option in later version.