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

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

凡尘雨 发布于 2021-11-30 字数 224 浏览 828 回复 1 原文

I want to get a carriage return/new line by hitting the return key
on an UITextField's keyboard.
I've found out, that textFieldShouldReturn gets called.

But how do I insert a carriage return in the text field?

如果你对这篇文章有疑问,欢迎到本站 社区 发帖提问或使用手Q扫描下方二维码加群参与讨论,获取更多帮助。

扫码加入群聊

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

堇年纸鸢 2022-06-07 1 楼

You want to use a UITextView instead. UITextFields are meant for single line input whereas UITextViews support multi-line input.