On Apr 20, 2008, at 8:12 PM, Jens Alfke wrote:


On 20 Apr '08, at 5:38 PM, Jack Repenning wrote:

I confess what I actually want is a bit more complicated than always positioning at the bottom: if the user has moved the thumb about, then the user's chosen position should win; it's only if the thumb is bottomed at the moment I add the next line that I would "autoscroll." I suspect some further subtleties lurk in the neighborhood of the transition out of "not enough data even to fill one screen full." This seems familiar enough, and subtle enough, that surely it must be hiding in the library somewhere? I don't have to reinvent this wheel, do I? Because I went lookin' for the pieces to do that, and came up dry there as well!

You have to implement it yourself.

1. Before appending text, check the view's vertical scroller to see if it's at the bottom.
2. Append the text.



3. If the scroller used to be at the end, scroll to the bottom by getting the coordinates of the bottom of the view and telling the view to scroll to there by calling scrollRectToVisible:.

Or you could tell the text view to scrollRangeToVisible:

(typed into mail)

[myTextView scrollRangeToVisible:NSMakeRange([[myTextView string] length], 0)]

--Nathan
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to