0

I have a UITextView within a UIScrollView in one of my controllers.

The problem is that when you enter text and get to the bottom of the scrollView, the last line of text (the one you're typing) actually extends beyond the bottom of the scroll view and is hidden.

Any help would be much appreciated.

scrollView.frame =  CGRectMake(15.0f, 20.0f+15.0f, self.view.frame.size.width-15.0f*2.0f, self.view.frame.size.height-keyboardBar.frame.size.height-keyboardBounds.size.height-20.0f-15.0f*3.0f);

postTextView.frame = CGRectMake(0.0f, 0.0f, scrollView.frame.size.width, scrollView.frame.size.height);

[self.view addSubview:scrollView];
[scrollView addSubview:postTextView];

`

Erica Tripp
  • 316
  • 2
  • 8
  • it looks like this may be iOS 7 specific. http://stackoverflow.com/questions/18966675/uitextview-in-ios7-clips-the-last-line-of-text-string I removed the scrollView entirely since UITextView can be scrollable on its own, and I'm still having the problem in iOS 7 – Erica Tripp Sep 24 '13 at 04:41

1 Answers1

0

You need to set the content size of the scroll view so that it knows how to scroll its subviews:

[scrollView setContentSize:postTextView.frame.size];

The frame of the scroll view is just the space it takes up by itself on self.view. The content size is the size that all of the scroll view's subviews will take up inside of the scroll view.

sghodas
  • 28
  • 2
  • 8
  • tried this, and unfortunately it didn't solve the problem. postTextView is also the only subview within scrollView. – Erica Tripp Sep 24 '13 at 02:33