UILabel with fixed width and flexible height

前端 未结 2 966
旧巷少年郎
旧巷少年郎 2021-02-09 05:26

I\'ve got an UILabel in a Detail View Controller, so its content changes depending on the selected table row. I have a problem, I would set a fixed width for my UILabel and a dy

2条回答
  •  时光说笑
    2021-02-09 06:11

    You can do it ..here is code.

    UILabel *yourlabel = [[UILabel alloc] initWithFrame:CGRectMake(x, y, 100, sizeToFit)];
    yourlabel.numberOfLines = 0;
    

    For Any Query please comment.

提交回复
热议问题