UITextView
height doesn't work on iPhone when I use dynamic content from UITextViewCell
. On any iPad it works is well. I already read it(How do I size a UITextView to its content?) but it didn't help me.
My code is below
@IBOutlet weak var textView: UITextView! {
didSet {
textView?.text = textOfText
self.textView.delegate = self
self.textView.editable = false
self.textView.scrollEnabled = false
}
}
@IBOutlet weak var textViewHeight: NSLayoutConstraint! {
didSet {
self.textViewHeight.constant = self.textView.sizeThatFits(CGSizeMake(self.textView.frame.size.width, CGFloat.max)).height
}
}
UPDATED
That is how same text is look on iPhone and iPad.
UPDATED 2 I made following code
@IBOutlet weak var textView: UITextView! {
didSet {
textView?.text = textOfText
self.textView.delegate = self
self.textView.editable = false
self.textView.scrollEnabled = false
var frame: CGRect!
frame = textView.frame
frame.size.height = textView.contentSize.height
textView.frame = frame
}
}