Reputation: 2133
I have a UITextView that will have lines added as events happen, as a sort of log to show what is happening. I want it to function like the debugger window in Xcode. New line appears on the bottom and text automatically scrolls up as new text is added. I only need the text actually displayed to be stored, so purging text that leaves the textView would also be good.
In looking through the documentation, I see a method to scroll to the top, but not to the bottom.
Upvotes: 2
Views: 859
Reputation: 16946
You can use UIScrollView
's scrollRangeToVisible
:
CGPoint p = [helpText contentOffset];
[helpText setContentOffset:p animated:NO];
[scrollView scrollRangeToVisible:NSMakeRange([scrollView.text length] - 1, 0)];
Upvotes: 1