开发者

UITextView Auto Height [duplicate]

This question already has answers here: How do I size a UITextView to its content? (41 answers) 开发者_如何学C Closed 10 years ago.

How do I make a UITextView expand or shrink to the size of the text inside it and then make the UIScrollview Expand or shrink to fit the UITextView


CGRect frame;
frame = textiew.frame;
frame.size.height = [textView contentSize].height;
textView.frame = frame;

One thing to note is that the correct contentSize is only available after the UITextView has been added to the view with addSubview and the text is assigned to it. Prior to that it is equal to frame.size

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜