I am encountering a strange behaviour when using UITextView
with a long text. In particular, when setting the maximumNumberOfLines
of its textContainer
to 0, the content disappears completely.
I have created a small test project to be sure there was nothing strange in my code that was causing it, and you can see it in the screenshots. In my project I have a UIViewController
that contains a UIScrollView
, that contains a vertical UIStackView
. The stack view contains a UITextView
(the red title in the screenshots), another stackview containing a label, text view, button, and then other text views.
When the button is clicked I am setting maximumNumberOfLines
to 0 (before it was 2), and the content just disappears. I've tried with and without animation and I have the same result.
The disappearing seems to be related to the height of the final text, as if I use a smaller font, the content disappears only after setting much more text.
Any ideas why it could be happening?
For completeness, I am using Xamarin.iOS, and here is my ViewController.