动态扩展UITextView [英] Dynamic expand UITextView
本文介绍了动态扩展UITextView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有UITextView,我想动态扩展它。如果文本应滚动我想扩展视图以适应文本的数量。我怎样才能做到这一点。谢谢
I have UITextView and I want to expand it dynamically. If the text is should scroll I want to expand the view to fit the amount of the text. How can I do that. Thanks
推荐答案
当您结束编辑文本时,请写下此内容。
When you end the editing of your text write this.
- (void) textViewDidEndEditing:(UITextView *)textView
{
CGRect frame = myTextView.frame;
frame.size.height = myTextView.contentSize.height;
myTextView.frame = frame;
}
这篇关于动态扩展UITextView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文