How to add line break for UILabel?

后端 未结 21 2143
失恋的感觉
失恋的感觉 2020-11-29 14:53

Let see that I have a string look like this:

NSString *longStr = @\"AAAAA\\nBBBBB\\nCCCCC\";  

How do I make it so that the UILabel disp

21条回答
  •  借酒劲吻你
    2020-11-29 15:33

    In xCode 11, Swift 5 the \n works fine, try the below code:

    textlabel.numberOfLines = 0
    textlabel.text = "This is line one \n This is line two \n This is line three"
    

提交回复
热议问题