当Text大于Height时如何增加UITextView的高度 [英] How to increase the height of UITextView when Text is more than Height

查看:27
本文介绍了当Text大于Height时如何增加UITextView的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 UITextView,当我在 5-6 行之后输入数据时,数据向上滚动并且看不到.当输入的文本超过高度时,是否有任何属性可用于增加 UITextView 的高度.

I have a UITextView and when i am entering data into that after 5-6 lines , the data is scrolling up and it cannot be seen. Is there any property that i can use to increase the height of UITextView as the text are entered more than height.

请推荐人.

推荐答案

使用这段代码可以让 UITextView 的高度和里面的内容高度一致.

Use this code to make the height of the UITextView be the same as the height of the content inside it.

CGRect frame = _textView.frame;
frame.size.height = _textView.contentSize.height;
_textView.frame = frame;

这篇关于当Text大于Height时如何增加UITextView的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆