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

jsnuff1

macrumors 6502a
Original poster
Oct 4, 2003
730
340
NY
I have a scroll view that adds content to the bottom of the view when a user does something. Unfortunately the view does not automatically scroll to the bottom when there is a new content update, and the user has to manualy scroll to the bottom to see the new content.

Is there a way to make UIScrollView automatically scroll to the bottom of the view when there is an update to the view?

Thanks.
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
Are you adding content to the view or just changing the contents of a view that's already added to the scrollview?

Did you try this:

Code:
- (void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated;         // scroll so rect is just visible (nearest edges). nothing if rect completely visible
 

jsnuff1

macrumors 6502a
Original poster
Oct 4, 2003
730
340
NY
im adding content, but i figured it out anyway.

[updateTextView scrollRangeToVisible:NSMakeRange([updateTextView.text length], 0)];

calling that method will do the trick for a UITextView. I think the method that phoneydevloper posted is for a UIScrollView.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.