3

Hi I have several UITextView's inside a UIScrollView. After a certain action occurs, I change the text of all the UITextView's using [info setText:@"blahblah"], then I modify each TextView's frame so that all the text is viewable. Then I change the content size of the UIScrollView so that it fits all the text.

The problem is that after I do this it scrolls when I would like for it to stay at the top of the screen. [scrollView setContentOffset:CGPointMake(0,0) animated:YES]; doesn't seem to keep the scrollView at the top.

Any Ideas?

thechengster
  • 133
  • 1
  • 10

3 Answers3

0

I used another view in mine, eg: UIWebView, and covered it up with a button. That only works for non-editable.

Try: How to stop UITextView from scrolling up when entering it

Community
  • 1
  • 1
Stephen J
  • 2,367
  • 2
  • 25
  • 31
0

you can use scrollRectToVisible:animated: to keep the scrollview at the top

Aravindhan
  • 15,608
  • 10
  • 56
  • 71
-1

[scrollView setScrollsToTop:NO]; maybe?

Dan F
  • 17,654
  • 5
  • 72
  • 110
  • `setScrollsToTop:NO` doesn't effect the `UITextView` scrolling that's going on here, plus `setScrollsToTop:NO` would impact other functionality, like tapping the caption bar to scroll to top. – Gavin Hope May 03 '14 at 13:14