Vertically align UILabel

前端 未结 10 1580
故里飘歌
故里飘歌 2020-12-31 10:34

I am trying to vertically align the text in the UILabel view of my app. The problem is that I want the text to be vertically aligned to the top and the size of the label to

10条回答
  •  再見小時候
    2020-12-31 10:42

    You can do it as follows.......

    1. Set your label's numberOfLines property 0 from IB

    2. Set your label's lineBreakMode as UILineBreakModeWordWrap (very very important)

    now whatever you set on the label just append few @"\n" to it..... ex.-

    [yourTextLabel setText:@"myLabel\n\n\n\n\n"];
    

提交回复
热议问题