简体   繁体   English

iPhone UITextField:如何通过返回键插入新行?

[英]iPhone UITextField: how to insert new line by the return key?

I want to get a carriage return/new line by hitting the return key on an UITextField's keyboard. 我想通过点击UITextField键盘上的返回键来获得回车/换行。 I've found out, that textFieldShouldReturn gets called. 我发现,textFieldShouldReturn被调用了。

But how do I insert a carriage return in the text field? 但是如何在文本字段中插入回车符?

You want to use a UITextView instead. 您想要使用UITextView。 UITextFields are meant for single line input whereas UITextViews support multi-line input. UITextFields用于单行输入,而UITextViews支持多行输入。

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

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