如何在 iPhone 中的标签中换行?
我是 iPhone 开发新手。我想将文本包裹在标签中。我想包裹到标签中的特定位置。谢谢。
I am new to iphone development .I want to wrap up the text in the label.I want to wrap up to a particular position in the label.Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这将让它换行任意数量的行。如果您想限制它们,并用“...”截断它们,则将
numberOfLines
属性设置为该值。That'll let it wrap an arbitrary number of lines. If you want to limit them, and have it truncate with a “...”, then set the
numberOfLines
property to that value.将 Interface Builder ( http://drp.ly/d3K65 ) 中的“换行符”设置为“自动换行”并增加 UILabel 的高度。
您可以在代码中执行相同的操作(甚至更复杂),请参阅 UILabel 参考 http://developer.apple.com/iPhone/library/documentation/UIKit/Reference/UILabel_Class/Reference/UILabel.html
Set "Line breaks" in Interface Builder ( http://drp.ly/d3K65 ) to "Word Wrap" and increase height of the UILabel.
You can do the same thing (or even more complex) in the code, see UILabel reference http://developer.apple.com/iPhone/library/documentation/UIKit/Reference/UILabel_Class/Reference/UILabel.html