How do I size a UITextView to it's content?
Posted
by drewh
on Stack Overflow
See other posts from Stack Overflow
or by drewh
Published on 2008-09-08T19:21:19Z
Indexed on
2010/03/18
2:01 UTC
Read the original article
Hit count: 431
Is there a good way to adjust the size of a UITextView to conform to it's content? Say for instance I have a UITextView that contains one line of text:
"Hello world"
I then add another line of text:
"Goodbye world"
Is there a good way in Cocoa Touch to get the rect that will hold all of the lines in the text view so that I can adjust the parent view accordingly?
As another example, look at the Notes field for events in the Calendar application--note how the cell (and the UITextView it contains) expands to hold all lines of text in the notes string.
© Stack Overflow or respective owner