UITextView Interface Builder 多行问题

发布于 2024-12-26 20:09:06 字数 164 浏览 3 评论 0原文

我在 Interface Builder 中使用 UITextView 并在其中输入了大量文本,其中有很多换行符、空行。我通过输入内容并按 alt-return 来获得新行来完成此操作。

然而,当在我的设备上构建并运行时,没有看到这些换行符。有什么建议吗?有人听说过这个吗?

谢谢。

I am using a UITextView in Interface Builder and have typed a hunk of text into it and there are lots of lines breaks in it, blank lines. I did this by typing into it and alt-returning to get a new line.

However when built and run on my device none of these line breaks are seen. Any tips? Anyone heard of this?

Thanks.

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

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

发布评论

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

评论(2

北座城市 2025-01-02 20:09:06

这对我有用:

在头文件中:

IBOutlet UITextView * textview;

在实现文件中:

textview.text = @"First line\nSecond line\n\nThere is a blank line above\n\tTabbed line";

不要忘记将 UITextView 与 Interface Builder 中的元素链接起来。

This works for me:

In the header file:

IBOutlet UITextView * textview;

In the implementation file:

textview.text = @"First line\nSecond line\n\nThere is a blank line above\n\tTabbed line";

Don't forget to link the UITextView with the element in the Interface Builder.

剪不断理还乱 2025-01-02 20:09:06

将文本写入文本文件。并使用一行代码将文件的内容加载到 UITextView 中。如果您有很多文本要输入,那就容易多了。

Write the text into a text file. And use a line of code to load the file's content into your UITextView. Much easier if you have a lot of text to input.

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