Vertically Align UILabel text with constraints and no wrap (auto layout, single line)

前端 未结 4 1738
深忆病人
深忆病人 2021-02-05 13:19

So I have my view setup in IB such that this text label aligns with the top of the thumbnail via constraints.

\"ente

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-05 13:27

    What you're looking for is these two lines of code.

    myLabel.numberOfLines = 0;
    myLabel.lineBreakMode = UILineBreakModeWordWrap;
    

    and you will also find this in the Attributes Inspector under "Line Breaks" and "Lines".

提交回复
热议问题