4

I have noticed in iOS 7 the last line of a UITextView after reaching the bottom is always hidden. This even happens in the Calendar app when you add a note to an event.

I have tried setting contentInsets and textContainerInset, none of them have made any difference.

Has anyone else experienced this issue and if so is there a workaround?

Calendar UITextView Bug

JLau_cy
  • 705
  • 1
  • 7
  • 14

2 Answers2

2

I am having alternate solution to overcome the problem:

  1. Implement TextViewDelegate in your ViewController.
  2. Set delegate to self for your textView.
  3. Implement textView:(UITextView *)textView shouldChangeTextInRange:.

Example:

- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
    [textView scrollRangeToVisible:range];

    return YES;
}

Now, run your code, By doing this, when you press '\n'(Enter) your curson will not be visible, but as you press the next character it will be going to make it visible.

Salman Zaidi
  • 9,342
  • 12
  • 44
  • 61
Mehul Thakkar
  • 12,440
  • 10
  • 52
  • 81
  • 1
    There is also another solution over here, you can also use that one http://stackoverflow.com/questions/18966675/uitextview-in-ios7-clips-the-last-line-of-text-string/19277383#19277383 – Mehul Thakkar Oct 25 '13 at 09:42
  • Just your approach, the issue is the textView scrolls with the second character after \n and not the next one directly after \n. Any ideas? – JLau_cy Oct 25 '13 at 10:59
  • Ya, i know that, it was the way i know, you can use the link that i provided in my previos comment, i dont have tried this but, i think so, that will work – Mehul Thakkar Oct 28 '13 at 06:05
0

I tried to use this Library, that claims to fix the problem, it's better, but not quite fixing the problem

https://github.com/Exile90/ICTextView

skittle
  • 248
  • 2
  • 9