Blog

UITextView's intrinsicContentSize

Published 1 min read

A UITextView's intrinsicContentSize is enabled when isScrollEnabled is false.

Let's look closer.

  • If you create a textView and set isScrollEnabled to true

(-1.0, -1.0) is printed.

In Swift, when there is no intrinsicContentSize, it has the value (-1, -1).

(I'm not sure it's always -1, -1, but UIView also gives -1, -1 when there's no value.)

  • This time, if we set isScrollEnabled to false and print it

(10.0, 52.0) is printed.

Now there's an intrinsicContentSize.

To sum up again, setting isScrollEnabled to false enables the UITextView's intrinsicContentSize.

Comments

Leaving a comment stores your nickname (or GitHub profile info). Privacy policy

GitHub