ios - UILabel 的text中,能识别换行符吗
PHP中文网
PHP中文网 2017-04-18 09:07:29
0
2
714
@IBOutlet var lable: UILable?
lable.text = "asdfasdfasdfasdf"

能否在 字符串中间加入 "\n" 这样的换行符呢?

希望能够给出稍微详细一些的回答

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(2)
左手右手慢动作

I found a way, set the following two properties, and then n it will take effect

Label.lineBreakMode = NSLineBreakMode.ByWordWrapping
Label.numberOfLines = 0

label.text = "lineone\nlinetwo"
洪涛

Yes. But you have to set the numberoflines of UILabel

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template