1

My UITextView is being very weird.

To explain the problem, the UITextView is placed in an UITableViewCell, and at the first display, the second line is missing :

enter image description here

If I continue scrolling down, and go back to see this UITextView, everything is back to normal:

enter image description here

What is very weird, is that if I set my UITextView as none selectable (what I want in fact), the text is well displayed, but the font is lost :

enter image description here

It seems that I have the same problem described here: UITextView - setting font not working with iOS 6 on XCode 5

and the fix given (setting the UITextView as Selectable) worked fine for the font. But this problem with the cropped text makes this solution inadequate.

The UITextView has a red background color to be sure that the size is ok.

Everything is done in a Storyboard, but I also tried to set the font manually, the problem is still there.

Have you any hint of what could be wrong?

Community
  • 1
  • 1
Vico
  • 1,696
  • 1
  • 24
  • 57
  • I had a similar problem before, UITextView seems to have some bugs. What I did was to increase the height of the text view, made it larger than what was necessary, and the full text appeared. Check if that works for you. – Tiago Lira Sep 05 '14 at 17:53
  • It seems working, but it's not exactly what I want to do ^^ I have another solution, do `[cell.textview layoutIfNeeded]` but I'm afraid it kills my `UITableView` performance... – Vico Sep 05 '14 at 18:00
  • Could you please post the code you have within cellForRowAtIndexPath: – Jim Tierney Sep 05 '14 at 19:32
  • Also having serious problems with UITextView. – amergin Sep 30 '14 at 14:40

1 Answers1

0

You can use AutoLayout to adjust the UITextView size inside the cell or you can use

[cell.textView sizeToFit];

I recommend using AutoLayout as it shouldn't harm the performance so much.

tmagalhaes
  • 944
  • 9
  • 12