How to add line break for UILabel?

后端 未结 21 2163
失恋的感觉
失恋的感觉 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:28

    Use option-return when typing in the little box in Interface Builder to insert a line feed (\n). In Interface Builder's Label attributes, set # Lines = 0.

    Select the label and then change Lines property to 0 like in the above image, and then use \n in your string for line break.

提交回复
热议问题