2

I have UITextView and a situation that is problematic. I write line of text in the UITextView, and then press return for new line. What happen is, the line that i entered is moving up so i can't see it, and i am able to continue writing. This is bad behavior for me, because i need the line to stay, and only move up when i reach the bottom of the UITextView.

  • I've read other similar posts but they wasn't helpfull.

Is someone familiar with this thing?

Shay
  • 2,595
  • 3
  • 25
  • 35

1 Answers1

0

I had luck using this solution: How to stop UITextView from scrolling up when entering it

However, I also found depending on the size of my UITextView, the insets needed to get it to scroll correctly varied and subclassing wasn't always necessary. For instance, for a text view of height 40 (very small for a UITextView), I did the following:

textView_ = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 300, 40)];
textView_.contentInset = UIEdgeInsetsMake(-6, -8, 0, 0);
Community
  • 1
  • 1
Alex Pretzlav
  • 15,505
  • 9
  • 57
  • 55