0

I added a UITextView to a UIViewController. In situations where there's a lot of text in the textView, the keyboard covers it up creating a need to scroll to see parts of the text. In the attached image you can see that the textView has scrolling enabled as well as User Interaction enabled, yet I'm unable to scroll to view the text covered by the keyboard.

I did not add an extra scroll view to the UIViewController as I assume these settings don't require me to.

Can you explain why I'm not able to scroll? enter image description here

Leahcim
  • 35,491
  • 52
  • 174
  • 313

2 Answers2

1

When working with scrollview, the text has to be longer than the actual height of the textview. This is because textview has a UIScrollView within it, and that is why it is able to scroll text.

Solution: Just make the text much longer than the height of your UITextView object, and it'll work.

In regards to where you say the keyboard covers up the text, here is a link that I am sure will help you out.

How to make text move up when keyboard appears

Hope this helps

Community
  • 1
  • 1
user2277872
  • 2,896
  • 1
  • 18
  • 21
1

UITextView is a subclass of UIScrollView, because of this you there is a content size property.

You can increase the height of the content size when they keyboard is shown. This will allow the scroll view to be scrolled up past the keyboard. Then remove the added height when the keyboard is hidden.

Vince
  • 214
  • 1
  • 5