在 UITextView 中显示没有 \n 的段落
有没有一种方便的方法来格式化一个相当长的字符串,其中包含段落(如下所示),使其包含 \n
,这样 textView 也会显示段落?
blah
blah
发送至@"blah\n\nblah"
谢谢!
Is there a convenient way to format a rather long string with paragraphs in it (like below) to have it with \n
in it so the textView will display the paragraphs as well?
blah
blah
to @"blah\n\nblah"
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个简单的示例,假设您有:
在文本文件中写入您想要的任何内容,并将其放置在您想要的位置Xcode 项目(通常从 Xcode 中的“Ressources”下导入),然后在代码中的某个位置(init 方法或操作):
Here's a simple example assuming you have :
Write whatever you want in your text file and place it wherever you want in your Xcode project (usually import it from within Xcode under "Ressources"), and then somewhere in your code (init method or action) :
您可以将文本存储在 Bundle 中的 .txt 文件中,并使用以下命令加载它
You can store your text in a .txt file in your Bundle and load it with