如何在 Xcode 标签中设置换行符?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3261230/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to set the line break in Xcode label?
提问by Questions
I want to ask an stupid question about the Xcode. I use the .xib to add a Label to my interface and I type something in the Label. For example, Hello World. How can I set the 2 words or 3 words in different lines?
我想问一个关于 Xcode 的愚蠢问题。我使用 .xib 将标签添加到我的界面,并在标签中键入一些内容。例如,Hello World。如何在不同行中设置 2 个或 3 个单词?
Example:
例子:
Hello World // I don't want this
Hello World // 我不想要这个
Hello // this is correct
你好 // 这是正确的
World
世界
Thank you very much.
非常感谢。
回答by JWWalker
I'll assume you're talking about a Cocoa xib, not a Carbon xib. Draw a "multi-line label" item from the library palette into your window, and then you can get multiple lines by word wrapping. If you want a hard line break, type option-return while editing the text.
我假设您在谈论 Cocoa xib,而不是 Carbon xib。从库调色板中绘制一个“多行标签”项到您的窗口中,然后您可以通过自动换行获得多行。如果您想要硬换行,请在编辑文本时键入 option-return。