如何使UITextView展开像Notes应用程序之类的文本 [英] How to make a UITextView Expand with the text like the Notes app
本文介绍了如何使UITextView展开像Notes应用程序之类的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使UITextView包含其内部的文本展开?
How can you make a UITextView expand with the text that is inside of it?
推荐答案
您可以尝试...
UITextView *textView; // your UITextView
NSString *text; // the text that you want to place in the UITextView
UIFont *textViewFont; // the font that you are using for your UITextView
CGSize size = {255,2000.0f}; //The default width, and max height you want to use
CGSize newSize = [text sizeWithFont:textViewFont
constrainedToSize:size lineBreakMode:UILineBreakModeWordWrap];
textView.frame = CGRectMake(0,0,newSize.width, newSize.height);
这篇关于如何使UITextView展开像Notes应用程序之类的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文