i have app that have table with many cells, when user tap on it, then detail view controller appear. Detail View Controller have an image and UITextView
, that is not editable and it purpose only for showing text (just like label). Text it contain come from an xml file, sometimes it have several rows, sometimes there is a lot of text.
What i want is - to make UITextView
height change depending of amount of text it have. For example, for several rows it might be 50 pixels height, in other case 300 pixels. How could i measure correct height and set it for UITextView
? Again i want to point that it purpose only for showing text, not edit in any way. My second task is to measure final UITextView
height and store it in some variable.
And there is what i've tried:
CGRect textViewRect = self.myTextView.frame;
textViewRect.size.height = self.myTextView.contentSize.height;
self.myTextView.frame = textViewRect;
But apparently its not working. Any idea how to achieve that?
Any advice would be appreciated, thanks!