I read all exists solution on stackoverflow for similar trouble but without lack.
Trouble in UITextView when i try scroll text to position with animation. Top part of text disappear when scroll with animation, but if font size 15pt all is ok but if around 50pt then something goes wrong.
You can see it on video https://www.youtube.com/watch?v=EvIur672Q5k
I also try create my own method to animate scroll with loop and each loop move offset on 0.5pt it works but this utilised processor too much, and i cannot control animation time, because processor overloaded. https://www.youtube.com/watch?v=Kw5hx3YAdMw
I also try create UITextView programmatically with same result.
I try split animation on parts with linear curve but it so ugly animation with shake.
- (IBAction) start{
_textView.scrollEnabled = NO;
_textView.scrollEnabled = YES;
UITextPosition *Pos2 = [_textView positionFromPosition: _textView.beginningOfDocument offset: 501];
UITextPosition *Pos1 = [_textView positionFromPosition: _textView.beginningOfDocument offset: 500];
UITextRange *range = [_textView textRangeFromPosition:Pos1 toPosition:Pos2];
CGRect result1 = [_textView firstRectForRange:(UITextRange *)range];
result1.origin.x=0;
[UIView animateWithDuration:2.0 delay:0.0 options:UIViewAnimationOptionCurveLinear animations:^{
_textView.contentOffset = result1.origin;
} completion:^(BOOL finished){
}];
}
I believe you're trying to do this
- (IBAction)start:(id)sender {
_textView.scrollEnabled = NO;
_textView.scrollEnabled = YES;
NSRange bottom = NSMakeRange(_textView.text.length, 0);
[UIView animateWithDuration:2.0 delay:0.0 options:UIViewAnimationOptionCurveLinear animations:^{
[_textView scrollRangeToVisible:bottom];
} completion:nil];
}
This should make a range of the text length and scroll to the bottom of it for you. If I have misunderstood your problem please let me know and I'll do my best to help
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