首先设置textView不能滚动,
[textView setScrollEnabled:NO]
设置textview的文字,富文本文字同样可以
textview.text = string;
CGSize sizeThatFits = [textview sizeThatFits:CGSizeMake(textview.width, MAXFLOAT)];
textview.height = sizeThatFits.size.height;
首先设置textView不能滚动,
[textView setScrollEnabled:NO]
设置textview的文字,富文本文字同样可以
textview.text = string;
CGSize sizeThatFits = [textview sizeThatFits:CGSizeMake(textview.width, MAXFLOAT)];
textview.height = sizeThatFits.size.height;
本文标题:UITextView动态适应高度
本文链接:https://www.haomeiwen.com/subject/eoskjxtx.html
网友评论