Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

patrover

macrumors newbie
Original poster
Aug 15, 2009
25
0
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:
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?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.