简体   繁体   English

UITextView自定义输入(无键盘)iOS

[英]UITextView custom input (No keyboard) iOS

I am using an UITextView where I append input text based on custom buttons (No keyboard). 我正在使用UITextView,其中基于自定义按钮(无键盘)附加输入文本。 It all works fine except that when the text exceeds to a new line, the UITextField crops text instead of scrolling down to the new line (as happens when you input text with the system keyboard).. 一切正常,除了当文本超过新行时,UITextField裁剪文本而不是向下滚动到新行(如使用系统键盘输入文本时发生的情况)。

How can I fix this behavior? 如何解决此问题?

You have to scroll the text view yourself as the length of the text increases - I imagine the system keyboard does this itself too. 随着文本长度的增加,您必须自己滚动文本视图-我想系统键盘也可以这样做。

The relevant method is scrollRangeToVisible: . 相关方法是scrollRangeToVisible: The range argument should be the end of the text you have just inserted into the text view. 范围参数应该是您刚刚插入到文本视图中的文本的结尾。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM