I have the following code which scrolls a textview to the bottom with animation.
- (void)scrollTextViewToBottom:(UITextView *)textView {
[_logTextView scrollRangeToVisible:NSMakeRange([_logTextView.text length], 0)];
}
I've seen some other examples that use contentOffset but that may have a bug? as it gives inconsistent results.
Perhaps you can try:
- (void)scrollTextViewToBottom:(UITextView *)textView {
[UIView setAnimationsEnabled:NO];
[_logTextView scrollRangeToVisible:NSMakeRange([_logTextView.text length], 0)];
[UIView setAnimationsEnabled:YES];
}
CGPoint bottomOffset = CGPointMake(0, self.scrollView.contentSize.height - self.scrollView.bounds.size.height);
[self.scrollView setContentOffset:bottomOffset animated:NO];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With