如何让 UITextView 尊重 Interface Builder 中的换行符?

发布于 2024-07-19 08:33:37 字数 192 浏览 4 评论 0原文

我有一个简单的应用程序,其中将 UITextView 嵌入到 UIScrollView 中。 Interface Builder 不允许我添加多个换行符作为间距; 当我按回车键时,它会将其视为“输入结束”,而不是将换行符附加到 UITextView 中。

我怎样才能让它接受换行符作为间距?

I have a simple app with a UITextView embedded into a UIScrollView. Interface Builder won't let me add multiple newlines for spacing; when I hit return it sees that as "end of input" rather than appending the newline to the UITextView.

How can I get it to accept newlines for spacing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

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

评论(4

迷雾森÷林ヴ 2024-07-26 08:33:37

比以前的答案简单得多(并且更多基于 IB):

只需 Alt + ENTER 它将向 UITextView 发送换行符。

Much simpler (and more IB based) than previous answers:

Just Alt + ENTER It will send a newline to the UITextView.

我家小可爱 2024-07-26 08:33:37

在 TextEdit 中编写文本,然后复制/粘贴。

Write up your text in TextEdit, then copy/paste it in.

各自安好 2024-07-26 08:33:37

正如 sbwoodside 所说,文本编辑器是最简单的方法。

也就是说,如果您需要更多控制,或者它不太有效,请不要使用 IB。 理想情况下,如果您需要对长文本进行任何类型的格式化,请以编程方式进行。

IB 中的格式化非常糟糕。 我尝试在 UITextView 中添加一些“条款和条件”,这真的很痛苦。

到最后,这比搞IB容易多了……

As sbwoodside said, a text editor is the easiest way.

That said, ff you need more control, or it isn't quite working, don't use IB. Ideally, if you need any type of formatting for a long sting of text, do it programmatically.

Formatting in IB is horrible. I tried to add some "terms and conditions" in a UITextView and it was a real pain.

In the end it is easier than messing with IB...

太阳男子 2024-07-26 08:33:37

在 IB 中 Shift+Alt (Option)+Enter 是新段落

In IB Shift+Alt (Option)+Enter is as New paragraph

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文