i have a text view that i add text to it programmatically.
i'm trying to make it so the view will auto scroll as the text is added.
i found this:
but it doesnt work for me.
anyone had an idea?
i'm trying to make it so the view will auto scroll as the text is added.
i found this:
Code:
- (void)addToViewAndScroll:(NSString *)newText
{
CGPoint pt = prView.textView.contentOffset;
//write text
prView.textView.text = [NSString stringWithFormat:@"%@\n%@",prView.textView.text,newText];
//tell view to scroll if necessary
[prView.textView setContentOffset:pt animated:NO];
[prView.textView scrollRangeToVisible:NSMakeRange([prView.textView.text length], 0)];
}
but it doesnt work for me.
anyone had an idea?