UILabel - Wordwrap text

前端 未结 4 1892
北海茫月
北海茫月 2020-12-22 17:48

Is there any way to have a label wordwrap text as needed? I have the line breaks set to word wrap and the label is tall enough for two lines, but it appears that it will on

4条回答
  •  清酒与你
    2020-12-22 18:22

    In Swift you would do it like this:

        label.lineBreakMode = NSLineBreakMode.ByWordWrapping
        label.numberOfLines = 0
    

    (Note that the way the lineBreakMode constant works is different to in ObjC)

提交回复
热议问题